E2E: Rename end-to-end-tests-server to grafana-server (#44249)

* Rename to grafana-server / move scripts into new directory

* Change grafana-server step command

* Change scripts paths

* Use test grabpl version

* Update run-suite script

* Further name updates

* Update grabpl version

* Update contribute/style-guides/e2e-core.md

Co-authored-by: Maria Alexandra <239999+axelavargas@users.noreply.github.com>

Co-authored-by: Maria Alexandra <239999+axelavargas@users.noreply.github.com>
This commit is contained in:
Dimitris Sotirakis
2022-01-20 17:01:00 +00:00
committed by GitHub
co-authored by Maria Alexandra
parent 9ccc7ec76e
commit 22eb2df602
15 changed files with 108 additions and 102 deletions
+8 -8
View File
@@ -1,6 +1,6 @@
load('scripts/drone/vault.star', 'from_secret', 'github_token', 'pull_secret', 'drone_token', 'prerelease_bucket')
grabpl_version = 'v2.8.4'
grabpl_version = 'v2.8.5'
build_image = 'grafana/build-container:1.4.9'
publish_image = 'grafana/grafana-ci-deploy:1.3.1'
grafana_docker_image = 'grafana/drone-grafana-docker:0.3.2'
@@ -329,7 +329,7 @@ def upload_cdn_step(edition, ver_mode):
])
else:
deps.extend([
'end-to-end-tests-server',
'grafana-server',
])
return {
@@ -531,11 +531,11 @@ def test_a11y_frontend_step(ver_mode, edition, port=3001):
'name': 'test-a11y-frontend' + enterprise2_suffix(edition),
'image': 'grafana/docker-puppeteer:1.0.0',
'depends_on': [
'end-to-end-tests-server' + enterprise2_suffix(edition),
'grafana-server' + enterprise2_suffix(edition),
],
'environment': {
'GRAFANA_MISC_STATS_API_KEY': from_secret('grafana_misc_stats_api_key'),
'HOST': 'end-to-end-tests-server' + enterprise2_suffix(edition),
'HOST': 'grafana-server' + enterprise2_suffix(edition),
'PORT': port,
},
'failure': failure,
@@ -662,10 +662,10 @@ def e2e_tests_server_step(edition, port=3001):
}
if package_file_pfx:
environment['PACKAGE_FILE'] = 'dist/{}-*linux-amd64.tar.gz'.format(package_file_pfx)
environment['RUNDIR'] = 'e2e/tmp-{}'.format(package_file_pfx)
environment['RUNDIR'] = 'scripts/grafana-server/tmp-{}'.format(package_file_pfx)
return {
'name': 'end-to-end-tests-server' + enterprise2_suffix(edition),
'name': 'grafana-server' + enterprise2_suffix(edition),
'image': build_image,
'detach': True,
'depends_on': [
@@ -673,7 +673,7 @@ def e2e_tests_server_step(edition, port=3001):
],
'environment': environment,
'commands': [
'./e2e/start-server',
'./scripts/grafana-server/start-server',
],
}
@@ -688,7 +688,7 @@ def e2e_tests_step(suite, edition, port=3001, tries=None):
'package',
],
'environment': {
'HOST': 'end-to-end-tests-server' + enterprise2_suffix(edition),
'HOST': 'grafana-server' + enterprise2_suffix(edition),
},
'commands': [
'apt-get install -y netcat',
+2 -2
View File
@@ -22,8 +22,8 @@ if [ "$BASE_URL" != "" ]; then
echo -e "BASE_URL set, skipping starting server"
else
# Start it in the background
./e2e/start-server > e2e/server.log &
./e2e/wait-for-grafana
./scripts/grafana-server/start-server > scripts/grafana-server/server.log &
./scripts/grafana-server/wait-for-grafana
fi
# Run accessibility command
+2
View File
@@ -0,0 +1,2 @@
[feature_toggles]
enable =
+11
View File
@@ -0,0 +1,11 @@
#!/bin/bash
. scripts/grafana-server/variables
if [ -f "$PIDFILE" ]; then
echo -e "Found pidfile, killing running grafana-server"
kill -9 `cat $PIDFILE`
rm $PIDFILE
fi
rm -rf scripts/grafana-server/tmp
+61
View File
@@ -0,0 +1,61 @@
#!/bin/bash
set -eo pipefail
. scripts/grafana-server/variables
PORT=${PORT:-$DEFAULT_PORT}
PACKAGE_FILE=${PACKAGE_FILE:-$DEFAULT_PACKAGE_FILE}
./scripts/grafana-server/kill-server
mkdir $RUNDIR
echo -e "Copying grafana backend files to temp dir..."
# Expand any wildcards
pkgs=(${PACKAGE_FILE})
pkg=${pkgs[0]}
if [[ -f ${pkg} ]]; then
echo "Found package tar file ${pkg}, extracting..."
tar zxf ${pkg} -C $RUNDIR
mv $RUNDIR/grafana-*/* $RUNDIR
else
echo "Couldn't find package ${PACKAGE_FILE} - copying local dev files"
if [[ ! -f bin/grafana-server ]]; then
echo bin/grafana-server missing
exit 1
fi
cp -r ./bin $RUNDIR
cp -r ./public $RUNDIR
cp -r ./tools $RUNDIR
mkdir $RUNDIR/conf
mkdir $PROV_DIR
mkdir $PROV_DIR/datasources
mkdir $PROV_DIR/dashboards
cp ./scripts/grafana-server/custom.ini $RUNDIR/conf/custom.ini
cp ./conf/defaults.ini $RUNDIR/conf/defaults.ini
fi
echo -e "Copy provisioning setup from devenv"
cp devenv/datasources.yaml $PROV_DIR/datasources
cp devenv/dashboards.yaml $PROV_DIR/dashboards
cp -r devenv $RUNDIR
echo -e "Starting Grafana Server port $PORT"
$RUNDIR/bin/grafana-server \
--homepath=$HOME_PATH \
--pidfile=$RUNDIR/pid \
cfg:server.http_port=$PORT \
cfg:server.router_logging=1 \
cfg:app_mode=development
# 2>&1 > $RUNDIR/output.log &
# cfg:log.level=debug \
+10
View File
@@ -0,0 +1,10 @@
#!/bin/bash
DEFAULT_RUNDIR=scripts/grafana-server/tmp
RUNDIR=${RUNDIR:-$DEFAULT_RUNDIR}
HOME_PATH=$PWD/$RUNDIR
PIDFILE=$RUNDIR/pid
DEFAULT_PACKAGE_FILE=dist/grafana-*linux-amd64.tar.gz
PROV_DIR=$RUNDIR/conf/provisioning
DEFAULT_HOST=localhost
DEFAULT_PORT=3001
+11
View File
@@ -0,0 +1,11 @@
#!/bin/bash
set -eo pipefail
. scripts/grafana-server/variables
HOST=${HOST:-$DEFAULT_HOST}
PORT=${PORT:-$DEFAULT_PORT}
echo -e "Waiting for grafana-server to finish starting, host=$HOST, port=$PORT"
timeout 60 bash -c 'until nc -z $0 $1; do sleep 1; done' $HOST $PORT