graphql-engine/server/tests-py/docker-compose.yml
Samir Talwar 8cb2738cbe server/tests-py: Declaratively state the HGE environment variables.
This has two purposes:

* When running the Python integration tests against a running HGE instance, with `--hge-url`, it will check the environment variables available and actively skip the test if they aren't set. This replaces the previous ad-hoc skip behavior.
* More interestingly, when running against a binary with `--hge-bin`, the environment variables are passed through, which means different tests can run with different environment variables.

  On top of this, the various services we use for testing now also provide their own environment variables, rather than expecting a test script to do it.

In order to make this work, I also had to invert the dependency between various services and `hge_ctx`. I extracted a `pg_version` fixture to provide the PostgreSQL version, and now pass the `hge_url` and `hge_key` explicitly to `ActionsWebhookServer`.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6028
GitOrigin-RevId: 16d866741dba5887da1adf4e1ade8182ccc9d344
2022-09-28 09:21:02 +00:00

152 lines
4.4 KiB
YAML

# These services are brought up in 'run.sh' (see that file)
version: "3.6"
services:
cabal-update:
image: hasura/graphql-engine-server-builder:${HASURA_GRAPHQL_ENGINE_SERVER_BUILDER_SHA}
command:
- cabal
- update
volumes:
- .:/src
- hge-dist:/src/dist-newstyle
- cabal-cache:/root/.cabal
working_dir: /src
hge-build:
image: hasura/graphql-engine-server-builder:${HASURA_GRAPHQL_ENGINE_SERVER_BUILDER_SHA}
command:
- cabal
- build
- graphql-engine:exe:graphql-engine
volumes:
- ../..:/src
- hge-dist:/src/dist-newstyle
- cabal-cache:/root/.cabal
working_dir: /src
depends_on:
cabal-update:
condition: service_completed_successfully
tests-py:
build:
context: ../..
dockerfile: ./.buildkite/dockerfiles/server-pytest-runner/Dockerfile
image: hasura/graphql-engine-server-pytest-runner:${HASURA_GRAPHQL_ENGINE_SERVER_PYTEST_RUNNER_SHA}
command:
- ./oss-.circleci/test-server.sh
environment:
- CIRCLE_NODE_INDEX=1
- CIRCLE_NODE_TOTAL=1
- OUTPUT_FOLDER=/output
- GRAPHQL_ENGINE=/src/dist-newstyle/build/x86_64-linux/ghc-8.10.7/graphql-engine-1.0.0/x/graphql-engine/noopt/build/graphql-engine/graphql-engine
- HASURA_GRAPHQL_DATABASE_URL=postgresql://postgres:hasura@tests-py-postgres-1/postgres
- HASURA_GRAPHQL_DATABASE_URL_2=postgresql://postgres:hasura@tests-py-postgres-2/postgres
- HASURA_GRAPHQL_CITUS_SOURCE_URL=postgresql://postgres:hasura@citus/postgres
- HASURA_GRAPHQL_MSSQL_SOURCE_URL=DRIVER={ODBC Driver 17 for SQL Server};SERVER=mssql,1433;Uid=sa;Pwd=Password!;
- HASURA_GRAPHQL_PG_SOURCE_URL_1=postgresql://postgres:hasura@tests-py-postgres-1/postgres
- HASURA_GRAPHQL_PG_SOURCE_URL_2=postgresql://postgres:hasura@tests-py-postgres-2/postgres
- HASURA_BIGQUERY_PROJECT_ID
- HASURA_BIGQUERY_SERVICE_KEY
- SERVER_TEST_TO_RUN
volumes:
- ../..:/src
- hge-dist:/src/dist-newstyle
- output:/output
working_dir: /src
depends_on:
hge-build:
condition: service_completed_successfully
citus:
condition: service_healthy
mssql-healthcheck:
condition: service_healthy
postgres:
condition: service_healthy
citus:
image: citusdata/citus:10.1@sha256:7e497e5ca18d7f2ae2a66c1d5d676b548e9221b7e6294adfb03006adad85502c
ports:
- 5432
environment:
POSTGRES_PASSWORD: "hasura"
healthcheck:
test:
- CMD-SHELL
- psql -U postgres < /dev/null && sleep 5 && psql -U postgres < /dev/null
start_period: 5s
interval: 5s
timeout: 10s
retries: 10
volumes:
- /var/lib/postgresql/data
mssql:
# Uses a different image for arm64.
image: ${MSSQL_IMAGE:-mcr.microsoft.com/mssql/server:2019-latest@sha256:a098c9ff6fbb8e1c9608ad7511fa42dba8d22e0d50b48302761717840ccc26af}
ports:
- 1433
environment:
ACCEPT_EULA: "Y"
SA_PASSWORD: "Password!"
MSSQL_SA_PASSWORD: "Password!"
volumes:
- /var/opt/mssql
# This is necessary because on macOS on amd64, the `mssql/server` image is not available.
# We use the `azure-sql-edge` image instead, which does not ship with `sqlcmd` on amd64.
mssql-healthcheck:
image: mcr.microsoft.com/mssql-tools
command:
- sleep
- inf
init: true # handle signals correctly
healthcheck:
test:
- CMD-SHELL
- |
/opt/mssql-tools/bin/sqlcmd -S 'mssql,1433' -U SA -P "Password!"
start_period: 5s
interval: 5s
timeout: 10s
retries: 10
depends_on:
mssql:
condition: service_started
postgres:
image: cimg/postgres:14.4-postgis@sha256:492a389895568e2f89a03c0c45c19350888611001123514623551a014e83a625
command:
- -F # turn fsync off for speed
- -N 1000 # increase max connections from 100 so we can run more HGEs
ports:
- 5432
environment:
POSTGRES_PASSWORD: "hasura"
healthcheck:
test:
- CMD-SHELL
- psql -U postgres < /dev/null && sleep 5 && psql -U postgres < /dev/null
start_period: 5s
interval: 5s
timeout: 10s
retries: 10
volumes:
- /var/lib/postgresql/data
deploy:
replicas: 2
postgres-healthy:
image: busybox
command:
- 'true'
depends_on:
postgres:
condition: service_healthy
volumes:
cabal-cache:
hge-dist:
output: