E2E: Run e2e tests on PRs and easy local isolated e2e grafana server setup & conf (#22772)

* e2e: Trying to get end-2-end tests to run on PRs

* Probably need quotes here

* Change back to machine

* CI: only build amd64 docker

* lowercase docker image name

* Fixed docker image name

* added end-to-end-test

* Fixed paths

* Added setup_remote_docker

* Updated

* Minor tweak

* update

* Testing

* UpdateD#

* Making some progress

* Update

* Updated

* update

* Updated

* Updated

* testing

* Updated

* Updated

* Updated

* Updated

* updated

* Changed image

* Updated image

* updated

* Addd logging

* trying one more thing

* Fixed build-fast-frontend

* Updated

* Added devenv to end-to-end server setup

* removed file

* Updated

* Minor change

* Fixes

* Updated workspace, and tried to make naming and paths compatible with master & release jobs

* fixed syntax issue

* Updated truth

* Fixed path
This commit is contained in:
Torkel Ödegaard
2020-03-13 14:34:25 +01:00
committed by GitHub
parent b1e112923b
commit 64877baa82
8 changed files with 280 additions and 261 deletions

0
e2e/conf/scenario1.ini Normal file
View File

11
e2e/kill-server Executable file
View File

@@ -0,0 +1,11 @@
#!/bin/bash
. e2e/variables
if [ -f "$PIDFILE" ]; then
echo -e "Found pidfile, killing running grafana-server"
kill -9 `cat $PIDFILE`
rm $PIDFILE
fi
rm -rf e2e/tmp

12
e2e/run-suite Executable file
View File

@@ -0,0 +1,12 @@
#!/bin/bash
. e2e/variables
echo -e "Waiting for grafana-server to finish starting"
timeout 200 bash -c 'until nc -z $0 $1; do sleep 1; done' localhost $PORT
echo -e "Starting Cypress scenarios"
env BASE_URL=http://localhost:$PORT yarn e2e-tests

47
e2e/start-server Executable file
View File

@@ -0,0 +1,47 @@
#!/bin/bash
. e2e/variables
./e2e/kill-server
mkdir $RUNDIR
echo -e "Copying grafana backend files to temp dir..."
if [ -f $PACKAGE_FILE ]; then
echo "Found package tar file, extracting..."
tar zxf $PACKAGE_FILE -C $RUNDIR
mv $RUNDIR/grafana-*/* $RUNDIR
else
echo "Copying local dev files"
cp -r ./bin $RUNDIR
cp -r ./public $RUNDIR
mkdir $RUNDIR/conf
mkdir $PROV_DIR
mkdir $PROV_DIR/datasources
mkdir $PROV_DIR/dashboards
cp ./conf/defaults.ini $RUNDIR/conf/defaults.ini
cp ./conf/sample.ini $RUNDIR/conf/custom.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=$RUNDIR \
--pidfile=$RUNDIR/pid \
cfg:server.http_port=$PORT \
cfg:app_mode=development
# 2>&1 > $RUNDIR/output.log &
# cfg:log.level=debug \

7
e2e/variables Normal file
View File

@@ -0,0 +1,7 @@
#!/bin/bash
RUNDIR=e2e/tmp
PIDFILE=$RUNDIR/pid
PACKAGE_FILE=/tmp/workspace/oss/dist/grafana-*linux-amd64.tar.gz
PROV_DIR=$RUNDIR/conf/provisioning
PORT=3001