Commit e33b17fa by Leonard Gram

build: integration testing postegres on ci.

parent 50d1519a
...@@ -32,6 +32,25 @@ jobs: ...@@ -32,6 +32,25 @@ jobs:
name: mysql integration tests name: mysql integration tests
command: 'GRAFANA_TEST_DB=mysql go test ./pkg/...' command: 'GRAFANA_TEST_DB=mysql go test ./pkg/...'
postgres-integration-test:
docker:
- image: circleci/golang:1.10
- image: circleci/postgres:9.3-ram
environment:
POSTGRES_USER: grafanatest
POSTGRES_PASSWORD: grafanatest
POSTGRES_DB: grafanatest
working_directory: /go/src/github.com/grafana/grafana
steps:
- checkout
- 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 docker/blocks/postgres_tests/setup.sql'
- run:
name: postgres integration tests
command: 'GRAFANA_TEST_DB=postgres go test ./pkg/...'
codespell: codespell:
docker: docker:
- image: circleci/python - image: circleci/python
...@@ -210,6 +229,8 @@ workflows: ...@@ -210,6 +229,8 @@ workflows:
filters: *filter-not-release filters: *filter-not-release
- mysql-integration-test: - mysql-integration-test:
filters: *filter-not-release filters: *filter-not-release
- postgres-integration-test:
filters: *filter-not-release
- deploy-master: - deploy-master:
requires: requires:
- build-all - build-all
...@@ -218,6 +239,7 @@ workflows: ...@@ -218,6 +239,7 @@ workflows:
- codespell - codespell
- gometalinter - gometalinter
- mysql-integration-test - mysql-integration-test
- postgres-integration-test
filters: filters:
branches: branches:
only: master only: master
...@@ -235,6 +257,8 @@ workflows: ...@@ -235,6 +257,8 @@ workflows:
filters: *filter-only-release filters: *filter-only-release
- mysql-integration-test: - mysql-integration-test:
filters: *filter-only-release filters: *filter-only-release
- postgres-integration-test:
filters: *filter-only-release
- deploy-release: - deploy-release:
requires: requires:
- build-all - build-all
...@@ -243,4 +267,5 @@ workflows: ...@@ -243,4 +267,5 @@ workflows:
- codespell - codespell
- gometalinter - gometalinter
- mysql-integration-test - mysql-integration-test
- postgres-integration-test
filters: *filter-only-release filters: *filter-only-release
postgrestest: postgrestest:
image: postgres:latest image: postgres:9.3
environment: environment:
POSTGRES_USER: grafana POSTGRES_USER: grafana
POSTGRES_PASSWORD: password POSTGRES_PASSWORD: password
...@@ -13,4 +13,4 @@ ...@@ -13,4 +13,4 @@
network_mode: bridge network_mode: bridge
environment: environment:
FD_DATASOURCE: postgres FD_DATASOURCE: postgres
FD_PORT: 5432 FD_PORT: 5432
\ No newline at end of file
FROM postgres:latest FROM postgres:9.3
ADD setup.sql /docker-entrypoint-initdb.d ADD setup.sql /docker-entrypoint-initdb.d
CMD ["postgres"] CMD ["postgres"]
\ No newline at end of file
CREATE DATABASE grafanadstest; CREATE DATABASE grafanadstest;
REVOKE CONNECT ON DATABASE grafanadstest FROM PUBLIC; REVOKE CONNECT ON DATABASE grafanadstest FROM PUBLIC;
GRANT CONNECT ON DATABASE grafanadstest TO grafanatest; GRANT CONNECT ON DATABASE grafanadstest TO grafanatest;
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment