graphql-engine/server/tests-py/docker-compose.yml
Samir Talwar 7c452bfca1 server/tests-py: Spawn a new PostgreSQL schema ("database") per test.
When running using the "new" style (with a HGE binary, not a URL), a new PostgreSQL metadata and source database are created for each test. When we get this into CI, this should drastically reduce the flakiness.

I have also enabled parallelization by default when using `run-new.sh`. It's much faster.

I had to basically rewrite _server/tests-py/test_graphql_read_only_source.py_ so that it does two different things depending on how it's run. It's unfortunate, but it should eventually go away.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6879
GitOrigin-RevId: a121b9035f8da3e61a3e36d8b1fbc6ccae918fad
2022-11-15 19:08:53 +00:00

109 lines
3.2 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:${DOCKER_PLATFORM:-}-${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:${DOCKER_PLATFORM:-}-${HASURA_GRAPHQL_ENGINE_SERVER_BUILDER_SHA}
command:
- sh
- -c
- |
set -ex
cabal build graphql-engine:exe:graphql-engine
cabal list-bin graphql-engine:exe:graphql-engine > dist-newstyle/bin.txt
volumes:
- ../..:/src
- /dev/null:/src/cabal.project.local # don't include cabal.project.local in build
- 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:
- sh
- -c
- |
set -ex
export GRAPHQL_ENGINE="$$(cat dist-newstyle/bin.txt)"
./oss-.circleci/test-server.sh
environment:
- CIRCLE_NODE_INDEX=1
- CIRCLE_NODE_TOTAL=1
- OUTPUT_FOLDER=/output
- 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 18 for SQL Server};SERVER=sqlserver,1433;Uid=sa;Pwd=Password!;Encrypt=optional
- 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:
postgres:
condition: service_healthy
citus:
condition: service_healthy
sqlserver-healthcheck:
condition: service_healthy
postgres:
extends:
file: ../../docker-compose/databases.yaml
service: postgres
environment:
POSTGRES_PASSWORD: "hasura"
volumes:
- ./docker/postgres-init.sh:/docker-entrypoint-initdb.d/init.sh:ro
deploy:
replicas: 2
citus:
extends:
file: ../../docker-compose/databases.yaml
service: citus
environment:
POSTGRES_PASSWORD: "hasura"
sqlserver:
extends:
file: ../../docker-compose/databases.yaml
service: sqlserver
sqlserver-healthcheck:
extends:
file: ../../docker-compose/databases.yaml
service: sqlserver-healthcheck
depends_on:
sqlserver:
condition: service_started
volumes:
cabal-cache:
hge-dist:
output: