E2E: Use standalone Image Renderer for tests instead of plugin (#112266)

* E2E: Use standalone Image Renderer for tests instead of plugin

* E2E: Allow configuring image renderer version if needed
This commit is contained in:
Matheus Macabu
2025-10-14 09:21:54 +02:00
committed by GitHub
parent fb25d60308
commit 9a2a314dc9
6 changed files with 59 additions and 18 deletions
+29 -9
View File
@@ -12,6 +12,8 @@ fi
./scripts/grafana-server/kill-server
docker ps -q --filter "name=grafana-image-renderer" | xargs docker stop || true
mkdir $RUNDIR
echo -e "Copying grafana backend files to temp dir..."
@@ -55,9 +57,17 @@ elif [ -d "../e2e-playwright/test-plugins" ]; then
cp -r "../e2e-playwright/test-plugins" "$RUNDIR/data/plugins"
fi
if [ "$INSTALL_IMAGE_RENDERER" ]; then
echo -e "Installing image renderer"
$RUNDIR/bin/"$ARCH"grafana cli --pluginsDir "$RUNDIR/data/plugins" plugins install grafana-image-renderer
if [ "$START_IMAGE_RENDERER" ]; then
echo -e "Starting image renderer container"
docker run -d --rm --name=grafana-image-renderer -p ${IR_DEFAULT_PORT}:${IR_DEFAULT_PORT} grafana/grafana-image-renderer:${IMAGE_RENDERER_VERSION:-latest}
if [[ "$(uname)" == "Darwin" ]]; then
DOCKER_HOST="host.docker.internal"
echo "Detected Mac host, using $DOCKER_HOST as the Docker host"
else
DOCKER_HOST="172.17.0.1"
echo "Detected Linux host, using $DOCKER_HOST as the Docker host"
fi
fi
echo -e "Copy provisioning setup from devenv"
@@ -74,10 +84,20 @@ echo -e "Starting Grafana server port $PORT"
# We get a lot of "context canceled" errors from navigating away from pages,
# so filter them out because they're not useful
{
exec "$RUNDIR/bin/${ARCH}grafana" server \
--homepath="$HOME_PATH" \
--pidfile="$RUNDIR/pid" \
cfg:server.http_port="$PORT" \
cfg:enterprise.license_path="$1" \
2>&1
CMD=(
"$RUNDIR/bin/${ARCH}grafana" server
--homepath="$HOME_PATH"
--pidfile="$RUNDIR/pid"
cfg:server.http_port="$PORT"
cfg:enterprise.license_path="$1"
)
if [ "$START_IMAGE_RENDERER" ]; then
CMD+=(
cfg:rendering.callback_url="http://$DOCKER_HOST:$PORT"
cfg:rendering.server_url="http://localhost:$IR_DEFAULT_PORT/render"
)
fi
exec "${CMD[@]}" 2>&1
} | grep -v -i "context canceled"
+1
View File
@@ -8,3 +8,4 @@ PIDFILE=$RUNDIR/pid
PROV_DIR=$RUNDIR/conf/provisioning
DEFAULT_HOST=localhost
DEFAULT_PORT=3001
IR_DEFAULT_PORT=8081
+1 -1
View File
@@ -8,7 +8,7 @@ PORT=${PORT:-$DEFAULT_PORT}
printf "Waiting for grafana-server to finish starting, host=%s, port=%s" "$HOST" "$PORT"
timeout=60
timeout=180
elapsed=0
while ! curl -s -f http://$HOST:$PORT/health > /dev/null 2>&1; do