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
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 280 additions and 261 deletions

View File

@ -235,7 +235,7 @@ jobs:
- checkout
- run:
name: CI job started
command: './scripts/ci-job-started.sh'
command: "./scripts/ci-job-started.sh"
- run:
name: Copy artifacts from workspace
command: cp -r /tmp/workspace/enterprise/dist enterprise-dist
@ -252,11 +252,11 @@ jobs:
- enterprise/dist/grafana-*.msi.sha256
- run:
name: CI job failed
command: './scripts/ci-job-failed.sh'
command: "./scripts/ci-job-failed.sh"
when: on_fail
- run:
name: CI job succeeded
command: './scripts/ci-job-succeeded.sh'
command: "./scripts/ci-job-succeeded.sh"
when: on_success
release-next-packages:
@ -273,7 +273,7 @@ jobs:
command: npx lerna bootstrap
- run:
name: npm - Prepare auth token
command: 'echo //registry.npmjs.org/:_authToken=$NPM_TOKEN >> ~/.npmrc'
command: "echo //registry.npmjs.org/:_authToken=$NPM_TOKEN >> ~/.npmrc"
- run:
name: Release next packages
command: ./scripts/circle-release-next-packages.sh
@ -494,15 +494,10 @@ jobs:
end-to-end-tests:
docker:
- image: circleci/node:12-browsers
- image: grafana/grafana-dev:$CIRCLE_WORKFLOW_ID
steps:
- attach_workspace:
at: /tmp/workspace
- checkout
- run: dockerize -wait tcp://127.0.0.1:3000 -timeout 120s
- run:
name: CI job started
command: ./scripts/ci-job-started.sh
- restore_cache:
key: dependency-cache-{{ checksum "yarn.lock" }}
- run:
@ -513,9 +508,13 @@ jobs:
key: dependency-cache-{{ checksum "yarn.lock" }}
paths:
- node_modules
- run:
name: Start grafana-server
command: ./e2e/start-server
background: true
- run:
name: Run end-to-end tests
command: env BASE_URL=http://127.0.0.1:3000 yarn e2e-tests
command: ./e2e/run-suite
no_output_timeout: 5m
- store_artifacts:
path: public/e2e-tests/screenShots/theTruth
@ -526,14 +525,9 @@ jobs:
- store_artifacts:
path: public/e2e-tests/videos
destination: output-videos
- run:
name: CI job failed
command: ./scripts/ci-job-failed.sh
when: on_fail
- run:
name: CI job succeeded
command: ./scripts/ci-job-succeeded.sh
when: on_success
- store_artifacts:
path: e2e/tmp/data/log
destination: logs
mysql-integration-test:
docker:
@ -546,25 +540,25 @@ jobs:
MYSQL_PASSWORD: password
working_directory: /go/src/github.com/grafana/grafana
steps:
- checkout
- run:
name: ci job started
command: './scripts/ci-job-started.sh'
- run: sudo apt update
- run: sudo apt install -y default-mysql-client
- run: dockerize -wait tcp://127.0.0.1:3306 -timeout 120s
- run: cat devenv/docker/blocks/mysql_tests/setup.sql | mysql -h 127.0.0.1 -P 3306 -u root -prootpass
- run:
name: mysql integration tests
command: './scripts/circle-test-mysql.sh'
- run:
name: ci job failed
command: './scripts/ci-job-failed.sh'
when: on_fail
- run:
name: ci job succeeded
command: './scripts/ci-job-succeeded.sh'
when: on_success
- checkout
- run:
name: ci job started
command: "./scripts/ci-job-started.sh"
- run: sudo apt update
- run: sudo apt install -y default-mysql-client
- run: dockerize -wait tcp://127.0.0.1:3306 -timeout 120s
- run: cat devenv/docker/blocks/mysql_tests/setup.sql | mysql -h 127.0.0.1 -P 3306 -u root -prootpass
- run:
name: mysql integration tests
command: "./scripts/circle-test-mysql.sh"
- run:
name: ci job failed
command: "./scripts/ci-job-failed.sh"
when: on_fail
- run:
name: ci job succeeded
command: "./scripts/ci-job-succeeded.sh"
when: on_success
postgres-integration-test:
docker:
@ -576,25 +570,25 @@ jobs:
POSTGRES_DB: grafanatest
working_directory: /go/src/github.com/grafana/grafana
steps:
- checkout
- run:
name: ci job started
command: './scripts/ci-job-started.sh'
- run: sudo apt update
- run: sudo apt install -y postgresql-client
- run: dockerize -wait tcp://127.0.0.1:5432 -timeout 120s
- run: 'PGPASSWORD=grafanatest psql -p 5432 -h 127.0.0.1 -U grafanatest -d grafanatest -f devenv/docker/blocks/postgres_tests/setup.sql'
- run:
name: postgres integration tests
command: './scripts/circle-test-postgres.sh'
- run:
name: ci job failed
command: './scripts/ci-job-failed.sh'
when: on_fail
- run:
name: ci job succeeded
command: './scripts/ci-job-succeeded.sh'
when: on_success
- checkout
- run:
name: ci job started
command: "./scripts/ci-job-started.sh"
- run: sudo apt update
- run: sudo apt install -y postgresql-client
- run: dockerize -wait tcp://127.0.0.1:5432 -timeout 120s
- run: "PGPASSWORD=grafanatest psql -p 5432 -h 127.0.0.1 -U grafanatest -d grafanatest -f devenv/docker/blocks/postgres_tests/setup.sql"
- run:
name: postgres integration tests
command: "./scripts/circle-test-postgres.sh"
- run:
name: ci job failed
command: "./scripts/ci-job-failed.sh"
when: on_fail
- run:
name: ci job succeeded
command: "./scripts/ci-job-succeeded.sh"
when: on_success
cache-server-test:
docker:
@ -603,65 +597,23 @@ jobs:
- image: memcached
working_directory: /go/src/github.com/grafana/grafana
steps:
- checkout
- run:
name: ci job started
command: './scripts/ci-job-started.sh'
- run: dockerize -wait tcp://127.0.0.1:11211 -timeout 120s
- run: dockerize -wait tcp://127.0.0.1:6379 -timeout 120s
- run:
name: cache server tests
command: './scripts/circle-test-cache-servers.sh'
- run:
name: ci job failed
command: './scripts/ci-job-failed.sh'
when: on_fail
- run:
name: ci job succeeded
command: './scripts/ci-job-succeeded.sh'
when: on_success
end-to-end-test-release:
docker:
- image: circleci/node:12-browsers
- image: grafana/grafana-dev:$CIRCLE_TAG
steps:
- run: dockerize -wait tcp://127.0.0.1:3000 -timeout 120s
- checkout
- run:
name: ci job started
command: './scripts/ci-job-started.sh'
- restore_cache:
key: dependency-cache-{{ checksum "yarn.lock" }}
- run:
name: yarn install
command: 'yarn install --pure-lockfile --no-progress'
no_output_timeout: 5m
- save_cache:
key: dependency-cache-{{ checksum "yarn.lock" }}
paths:
- node_modules
- run:
name: run end-to-end tests
command: 'env BASE_URL=http://127.0.0.1:3000 yarn e2e-tests'
no_output_timeout: 5m
- store_artifacts:
path: public/e2e-tests/screenShots/theTruth
destination: expected-screenshots
- store_artifacts:
path: public/e2e-tests/screenShots/theOutput
destination: output-screenshots
- store_artifacts:
path: public/e2e-tests/videos
destination: output-videos
- run:
name: ci job failed
command: './scripts/ci-job-failed.sh'
when: on_fail
- run:
name: ci job succeeded
command: './scripts/ci-job-succeeded.sh'
when: on_success
- checkout
- run:
name: ci job started
command: "./scripts/ci-job-started.sh"
- run: dockerize -wait tcp://127.0.0.1:11211 -timeout 120s
- run: dockerize -wait tcp://127.0.0.1:6379 -timeout 120s
- run:
name: cache server tests
command: "./scripts/circle-test-cache-servers.sh"
- run:
name: ci job failed
command: "./scripts/ci-job-failed.sh"
when: on_fail
- run:
name: ci job succeeded
command: "./scripts/ci-job-succeeded.sh"
when: on_success
codespell:
docker:
@ -670,14 +622,14 @@ jobs:
- checkout
- run:
name: install codespell
command: 'sudo pip install codespell'
command: "sudo pip install codespell"
- run:
# Important: all words have to be in lowercase, and separated by "\n".
name: exclude known exceptions
command: 'echo -e "unknwon\nreferer\nerrorstring\neror" > words_to_ignore.txt'
- run:
name: check documentation spelling errors
command: 'codespell -I ./words_to_ignore.txt docs/'
command: "codespell -I ./words_to_ignore.txt docs/"
lint-go:
docker:
@ -690,7 +642,7 @@ jobs:
- checkout
- run:
name: Lint Go
command: 'make lint-go'
command: "make lint-go"
shellcheck:
machine: true
@ -699,7 +651,7 @@ jobs:
- checkout
- run:
name: ShellCheck
command: 'make shellcheck'
command: "make shellcheck"
test-frontend:
docker:
@ -708,12 +660,12 @@ jobs:
- checkout
- run:
name: ci job started
command: './scripts/ci-job-started.sh'
command: "./scripts/ci-job-started.sh"
- restore_cache:
key: dependency-cache-{{ checksum "yarn.lock" }}
- run:
name: yarn install
command: 'yarn install --frozen-lockfile --no-progress'
command: "yarn install --frozen-lockfile --no-progress"
no_output_timeout: 15m
- save_cache:
key: dependency-cache-{{ checksum "yarn.lock" }}
@ -721,16 +673,16 @@ jobs:
- node_modules
- run:
name: frontend tests
command: './scripts/circle-test-frontend.sh'
command: "./scripts/circle-test-frontend.sh"
- store_test_results:
path: reports/junit
- run:
name: ci job failed
command: './scripts/ci-job-failed.sh'
command: "./scripts/ci-job-failed.sh"
when: on_fail
- run:
name: ci job succeeded
command: './scripts/ci-job-succeeded.sh'
command: "./scripts/ci-job-succeeded.sh"
when: on_success
test-backend:
@ -741,17 +693,17 @@ jobs:
- checkout
- run:
name: ci job started
command: './scripts/ci-job-started.sh'
command: "./scripts/ci-job-started.sh"
- run:
name: build backend and run go tests
command: './scripts/circle-test-backend.sh'
command: "./scripts/circle-test-backend.sh"
- run:
name: ci job failed
command: './scripts/ci-job-failed.sh'
command: "./scripts/ci-job-failed.sh"
when: on_fail
- run:
name: ci job succeeded
command: './scripts/ci-job-succeeded.sh'
command: "./scripts/ci-job-succeeded.sh"
when: on_success
build-fast-backend:
@ -762,24 +714,24 @@ jobs:
- checkout
- run:
name: prepare build tools
command: '/tmp/bootstrap.sh'
command: "/tmp/bootstrap.sh"
- run:
name: ci job started
command: './scripts/ci-job-started.sh'
command: "./scripts/ci-job-started.sh"
- run:
name: build grafana backend
command: './scripts/build/build.sh --fast --backend-only'
command: "./scripts/build/build.sh --fast --backend-only"
- persist_to_workspace:
root: .
paths:
- bin/*
- run:
name: ci job failed
command: './scripts/ci-job-failed.sh'
command: "./scripts/ci-job-failed.sh"
when: on_fail
- run:
name: ci job succeeded
command: './scripts/ci-job-succeeded.sh'
command: "./scripts/ci-job-succeeded.sh"
when: on_success
build-fast-frontend:
@ -794,21 +746,21 @@ jobs:
export NODE_OPTIONS=--max_old_space_size=4096
- run:
name: prepare build tools
command: '/tmp/bootstrap.sh'
command: "/tmp/bootstrap.sh"
- run:
name: ci job started
command: './scripts/ci-job-started.sh'
command: "./scripts/ci-job-started.sh"
- restore_cache:
key: frontend-dependency-cache-{{ checksum "yarn.lock" }}
- run:
name: build grafana frontend
command: './scripts/build/build.sh --fast --frontend-only'
command: "./scripts/build/build.sh --fast --frontend-only"
- run:
name: es-check install
command: 'yarn global add es-check'
command: "yarn global add es-check"
- run:
name: es-check run
command: 'es-check es5 ./public/build/*.js'
command: "es-check es5 ./public/build/*.js"
- save_cache:
key: frontend-dependency-cache-{{ checksum "yarn.lock" }}
paths:
@ -817,26 +769,27 @@ jobs:
root: .
paths:
- public/build/*
- public/views/*
- tools/phantomjs/*
- run:
name: ci job failed
command: './scripts/ci-job-failed.sh'
command: "./scripts/ci-job-failed.sh"
when: on_fail
- run:
name: ci job succeeded
command: './scripts/ci-job-succeeded.sh'
command: "./scripts/ci-job-succeeded.sh"
when: on_success
build-docs-website:
docker:
- image: grafana/build-container:1.2.13
- image: grafana/build-container:1.2.13
working_directory: /docs
steps:
- checkout
- setup_remote_docker
- run:
name: ci job started
command: './scripts/ci-job-started.sh'
command: "./scripts/ci-job-started.sh"
- run:
name: install docker
command: |
@ -854,11 +807,11 @@ jobs:
docker run --volumes-from docs-website --rm -it grafana/docs-base:latest /bin/bash -c 'npm i && make prod'
- run:
name: ci job failed
command: 'docker stop docs-website && docker rm docs-website && ./scripts/ci-job-failed.sh'
command: "docker stop docs-website && docker rm docs-website && ./scripts/ci-job-failed.sh"
when: on_fail
- run:
name: ci job succeeded
command: 'docker stop docs-website && docker rm docs-website && ./scripts/ci-job-succeeded.sh'
command: "docker stop docs-website && docker rm docs-website && ./scripts/ci-job-succeeded.sh"
when: on_success
build-fast-package:
@ -869,34 +822,37 @@ jobs:
- checkout
- run:
name: ci job started
command: './scripts/ci-job-started.sh'
command: "./scripts/ci-job-started.sh"
- attach_workspace:
at: .
- restore_cache:
key: frontend-dependency-cache-{{ checksum "yarn.lock" }}
- run:
name: prepare build tools
command: '/tmp/bootstrap.sh'
command: "/tmp/bootstrap.sh"
- run:
name: package grafana
command: './scripts/build/build.sh --fast --package-only'
command: "./scripts/build/build.sh --fast --package-only"
- run:
name: sha-sum packages
command: 'go run build.go sha-dist'
command: "go run build.go sha-dist"
- run:
name: Move artifacts
command: mkdir -p oss && mv dist oss
- run:
name: Test Grafana.com release publisher
command: 'cd scripts/build/release_publisher && go test .'
command: "cd scripts/build/release_publisher && go test ."
- persist_to_workspace:
root: /go/src/github.com/grafana/grafana
root: .
paths:
- dist/*
- oss/dist/*
- run:
name: ci job failed
command: './scripts/ci-job-failed.sh'
command: "./scripts/ci-job-failed.sh"
when: on_fail
- run:
name: ci job succeeded
command: './scripts/ci-job-succeeded.sh'
command: "./scripts/ci-job-succeeded.sh"
when: on_success
build-fast-save:
@ -907,53 +863,53 @@ jobs:
- checkout
- run:
name: ci job started
command: './scripts/ci-job-started.sh'
command: "./scripts/ci-job-started.sh"
- attach_workspace:
at: .
- restore_cache:
key: dependency-cache-{{ checksum "yarn.lock" }}
- run:
name: debug cache
command: 'ls -al /go/src/github.com/grafana/grafana/node_modules'
command: "ls -al /go/src/github.com/grafana/grafana/node_modules"
- run:
name: prepare build tools
command: '/tmp/bootstrap.sh'
command: "/tmp/bootstrap.sh"
- run:
name: build grafana backend
command: './scripts/build/build.sh --fast --backend-only'
command: "./scripts/build/build.sh --fast --backend-only"
- run:
name: build grafana frontend
command: './scripts/build/build.sh --fast --frontend-only'
command: "./scripts/build/build.sh --fast --frontend-only"
- save_cache:
key: dependency-cache-{{ checksum "yarn.lock" }}
paths:
- /go/src/github.com/grafana/grafana/node_modules
- run:
name: package grafana
command: './scripts/build/build.sh --fast --package-only'
command: "./scripts/build/build.sh --fast --package-only"
- run:
name: Prepare GPG private key
command: './scripts/build/prepare_signing_key.sh'
command: "./scripts/build/prepare_signing_key.sh"
- run:
name: sign packages
command: './scripts/build/sign_packages.sh dist/*.rpm'
command: "./scripts/build/sign_packages.sh dist/*.rpm"
- run:
name: sha-sum packages
command: 'go run build.go sha-dist'
command: "go run build.go sha-dist"
- run:
name: Test Grafana.com release publisher
command: 'cd scripts/build/release_publisher && go test .'
command: "cd scripts/build/release_publisher && go test ."
- persist_to_workspace:
root: .
paths:
- dist/*
- run:
name: ci job failed
command: './scripts/ci-job-failed.sh'
when: on_fail
name: ci job failed
command: "./scripts/ci-job-failed.sh"
when: on_fail
- run:
name: ci job succeeded
command: './scripts/ci-job-succeeded.sh'
command: "./scripts/ci-job-succeeded.sh"
when: on_success
grafana-docker-pr:
@ -963,20 +919,20 @@ jobs:
- checkout
- run:
name: ci job started
command: './scripts/ci-job-started.sh'
command: "./scripts/ci-job-started.sh"
- attach_workspace:
at: .
- run: docker info
- run: docker run --privileged linuxkit/binfmt:v0.6
- run: cp dist/grafana-latest.linux-*.tar.gz packaging/docker
- run: cp oss/dist/grafana-latest.linux-*.tar.gz packaging/docker
- run: cd packaging/docker && ./build.sh --fast "${CIRCLE_SHA1}"
- run:
name: ci job failed
command: './scripts/ci-job-failed.sh'
command: "./scripts/ci-job-failed.sh"
when: on_fail
- run:
name: ci job succeeded
command: './scripts/ci-job-succeeded.sh'
command: "./scripts/ci-job-succeeded.sh"
when: on_success
grafana-docker-ubuntu-pr:
@ -986,31 +942,22 @@ jobs:
- checkout
- run:
name: ci job started
command: './scripts/ci-job-started.sh'
command: "./scripts/ci-job-started.sh"
- attach_workspace:
at: .
- run: docker info
- run: docker run --privileged linuxkit/binfmt:v0.6
- run: cp dist/grafana-latest.linux-*.tar.gz packaging/docker
- run: cp oss/dist/grafana-latest.linux-*.tar.gz packaging/docker
- run: cd packaging/docker && ./build.sh --fast --ubuntu "${CIRCLE_SHA1}"
- run:
name: ci job failed
command: './scripts/ci-job-failed.sh'
command: "./scripts/ci-job-failed.sh"
when: on_fail
- run:
name: ci job succeeded
command: './scripts/ci-job-succeeded.sh'
command: "./scripts/ci-job-succeeded.sh"
when: on_success
store-build-artifacts:
docker:
- image: circleci/node:12
steps:
- attach_workspace:
at: .
- store_artifacts:
path: ./dist
build-grafana-packages:
docker:
- image: circleci/node:12
@ -1018,20 +965,20 @@ jobs:
- checkout
- run:
name: ci job started
command: './scripts/ci-job-started.sh'
command: "./scripts/ci-job-started.sh"
- run:
name: Boostrap lerna
command: 'npx lerna bootstrap'
command: "npx lerna bootstrap"
- run:
name: Build packages
command: yarn packages:build
- run:
name: ci job failed
command: './scripts/ci-job-failed.sh'
command: "./scripts/ci-job-failed.sh"
when: on_fail
- run:
name: ci job succeeded
command: './scripts/ci-job-succeeded.sh'
command: "./scripts/ci-job-succeeded.sh"
when: on_success
release-packages:
@ -1041,23 +988,23 @@ jobs:
- checkout
- run:
name: ci job started
command: './scripts/ci-job-started.sh'
command: "./scripts/ci-job-started.sh"
- run:
name: Boostrap lerna
command: 'npx lerna bootstrap'
command: "npx lerna bootstrap"
- run:
name: npm - Prepare auth token
command: 'echo //registry.npmjs.org/:_authToken=$NPM_TOKEN >> ~/.npmrc'
command: "echo //registry.npmjs.org/:_authToken=$NPM_TOKEN >> ~/.npmrc"
- run:
name: Release packages
command: ./scripts/build/release-packages.sh "${CIRCLE_TAG}"
- run:
name: ci job failed
command: './scripts/ci-job-failed.sh'
command: "./scripts/ci-job-failed.sh"
when: on_fail
- run:
name: ci job succeeded
command: './scripts/ci-job-succeeded.sh'
command: "./scripts/ci-job-succeeded.sh"
when: on_success
scan-docker-master:
@ -1325,7 +1272,6 @@ workflows:
filters: *filter-only-release
requires:
- end-to-end-tests
# TODO: Do we have more dependencies?
- publish-packages:
filters: *filter-master-or-release
name: publish-oss-packages
@ -1379,7 +1325,7 @@ workflows:
- end-to-end-tests:
filters: *filter-master-or-release
requires:
- build-oss-docker-images
- package-oss
- publish-docker-images:
filters: *filter-master-or-release
name: publish-oss-docker-images
@ -1414,72 +1360,67 @@ workflows:
- end-to-end-tests
build-branches-and-prs:
jobs:
- build-fast-backend:
filters: *filter-not-release-or-master
- build-fast-frontend:
filters: *filter-not-release-or-master
- build-grafana-packages:
filters: *filter-not-release-or-master
- build-fast-package:
filters: *filter-not-release-or-master
requires:
- build-fast-backend
- build-fast-frontend
- codespell:
filters: *filter-not-release-or-master
- lint-go:
filters: *filter-not-release-or-master
- shellcheck:
filters: *filter-not-release-or-master
- test-frontend:
filters: *filter-not-release-or-master
- test-backend:
filters: *filter-not-release-or-master
- mysql-integration-test:
filters: *filter-not-release-or-master
- postgres-integration-test:
filters: *filter-not-release-or-master
- cache-server-test:
filters: *filter-not-release-or-master
- grafana-docker-pr:
requires:
- build-fast-package
- test-backend
- test-frontend
- codespell
- lint-go
- shellcheck
- mysql-integration-test
- postgres-integration-test
- cache-server-test
filters: *filter-not-release-or-master
- grafana-docker-ubuntu-pr:
requires:
- build-fast-package
- test-backend
- test-frontend
- codespell
- lint-go
- shellcheck
- mysql-integration-test
- postgres-integration-test
- cache-server-test
filters: *filter-not-release-or-master
- store-build-artifacts:
requires:
- build-fast-package
- test-backend
- test-frontend
- codespell
- lint-go
- shellcheck
- mysql-integration-test
- postgres-integration-test
- cache-server-test
filters: *filter-not-release-or-master
- build-docs-website:
filters: *filter-not-release-or-master
jobs:
- build-fast-backend:
filters: *filter-not-release-or-master
- build-fast-frontend:
filters: *filter-not-release-or-master
- build-grafana-packages:
filters: *filter-not-release-or-master
- build-fast-package:
filters: *filter-not-release-or-master
requires:
- build-fast-backend
- build-fast-frontend
- codespell:
filters: *filter-not-release-or-master
- lint-go:
filters: *filter-not-release-or-master
- shellcheck:
filters: *filter-not-release-or-master
- test-frontend:
filters: *filter-not-release-or-master
- test-backend:
filters: *filter-not-release-or-master
- mysql-integration-test:
filters: *filter-not-release-or-master
- postgres-integration-test:
filters: *filter-not-release-or-master
- cache-server-test:
filters: *filter-not-release-or-master
- end-to-end-tests:
filters: *filter-not-release-or-master
requires:
- build-fast-package
- test-backend
- test-frontend
- lint-go
- grafana-docker-pr:
requires:
- build-fast-package
- test-backend
- test-frontend
- codespell
- lint-go
- shellcheck
- mysql-integration-test
- postgres-integration-test
- cache-server-test
filters: *filter-not-release-or-master
- grafana-docker-ubuntu-pr:
requires:
- build-fast-package
- test-backend
- test-frontend
- codespell
- lint-go
- shellcheck
- mysql-integration-test
- postgres-integration-test
- cache-server-test
filters: *filter-not-release-or-master
- build-docs-website:
filters: *filter-not-release-or-master
nightly:
triggers:
- schedule:

1
.gitignore vendored
View File

@ -11,6 +11,7 @@ awsconfig
/public/views/error.html
/emails/dist
/reports
/e2e/tmp
.yarnrc
.yarn/

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 26 KiB