From c68da40710fd4c837b43bdd0615bd7b7a2abe498 Mon Sep 17 00:00:00 2001 From: bergquist Date: Fri, 15 Feb 2019 15:05:01 +0100 Subject: [PATCH] run db tests in all packages --- .circleci/config.yml | 4 ++-- scripts/circle-test-mysql.sh | 17 +++++++++++++++++ scripts/circle-test-postgres.sh | 17 +++++++++++++++++ 3 files changed, 36 insertions(+), 2 deletions(-) create mode 100755 scripts/circle-test-mysql.sh create mode 100755 scripts/circle-test-postgres.sh diff --git a/.circleci/config.yml b/.circleci/config.yml index 8144956773b..69cea87dccd 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -35,7 +35,7 @@ jobs: - 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: 'GRAFANA_TEST_DB=mysql go test ./pkg/services/sqlstore/... ./pkg/tsdb/mysql/... ' + command: './scripts/circle-test-mysql.sh' postgres-integration-test: docker: @@ -54,7 +54,7 @@ jobs: - 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: 'GRAFANA_TEST_DB=postgres go test ./pkg/services/sqlstore/... ./pkg/tsdb/postgres/...' + command: './scripts/circle-test-postgres.sh' codespell: docker: diff --git a/scripts/circle-test-mysql.sh b/scripts/circle-test-mysql.sh new file mode 100755 index 00000000000..4d2fea90c4d --- /dev/null +++ b/scripts/circle-test-mysql.sh @@ -0,0 +1,17 @@ +#!/bin/bash +function exit_if_fail { + command=$@ + echo "Executing '$command'" + eval $command + rc=$? + if [ $rc -ne 0 ]; then + echo "'$command' returned $rc." + exit $rc + fi +} + +export GRAFANA_TEST_DB=mysql + +time for d in $(go list ./pkg/...); do + exit_if_fail go test -tags=integration $d +done \ No newline at end of file diff --git a/scripts/circle-test-postgres.sh b/scripts/circle-test-postgres.sh new file mode 100755 index 00000000000..7ddfe6887d9 --- /dev/null +++ b/scripts/circle-test-postgres.sh @@ -0,0 +1,17 @@ +#!/bin/bash +function exit_if_fail { + command=$@ + echo "Executing '$command'" + eval $command + rc=$? + if [ $rc -ne 0 ]; then + echo "'$command' returned $rc." + exit $rc + fi +} + +export GRAFANA_TEST_DB=postgres + +time for d in $(go list ./pkg/...); do + exit_if_fail go test -tags=integration $d +done \ No newline at end of file