graphql-engine/server/tests-py/run.sh
Samir Talwar fef1caabce server/tests-py: Support MSSQL and Citus with run.sh and run-new.sh.
This adds support for running the Python integration tests for MSSQL and Citus just as in CI, as follows:

```
./server/tests-py/run.sh backend-mssql
./server/tests-py/run.sh backend-citus
```

These run the named CI jobs, providing the appropriate backend.

(In reality, all backends are always provided, which is much simpler.)

It also provides the various databases to _server/tests-py/run-new.sh_, though the tests fail as they don't properly initialize the sources. (This will be fixed in the future by provisioning sources in the test framework itself.)

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5997
GitOrigin-RevId: c276a4779a35bb538ef0dc02ac8b7cb2d5a8dec5
2022-09-22 19:03:44 +00:00

56 lines
1.6 KiB
Bash
Executable File

#!/usr/bin/env bash
# This allows a developer, through Docker, to run the Python integration tests in pretty
# much exactly the same way as CI does (in contrast to `dev.sh test --integration`),
# allowing us to more readily diagnose issues locally.
#
# This takes an optional test configuration argument, corresponding to a name in
# `oss-.circleci/server-test-names.txt` (else defaulting to `no-auth`).
#
# See `case "$SERVER_TEST_TO_RUN"` in `oss-.circleci/test-server.sh` for what
# these actually do.
set -e
set -u
set -o pipefail
cd -- "$(dirname -- "${BASH_SOURCE[0]}")"
# copied from images.go
HASURA_GRAPHQL_ENGINE_SERVER_BUILDER_SHA="$(
sha256sum ../../.buildkite/dockerfiles/ci-builders/server-builder.dockerfile \
| awk '{ print $1 }'
)"
export HASURA_GRAPHQL_ENGINE_SERVER_BUILDER_SHA
# copied from images.go
HASURA_GRAPHQL_ENGINE_SERVER_PYTEST_RUNNER_SHA="$(
cat \
../../.buildkite/dockerfiles/server-pytest-runner/Dockerfile \
./requirements.txt \
./package-lock.json \
./package.json \
./remote_schemas/nodejs/package.json \
| sha256sum \
| awk '{ print $1 }'
)"
export HASURA_GRAPHQL_ENGINE_SERVER_PYTEST_RUNNER_SHA
if [[ $# -gt 0 ]]; then
SERVER_TEST_TO_RUN="$1"
else
SERVER_TEST_TO_RUN='no-auth'
fi
export SERVER_TEST_TO_RUN
# Use the Azure SQL Edge image instead of the SQL Server image on arm64.
# The latter doesn't work yet.
if [[ "$(uname -m)" == 'arm64' ]]; then
export MSSQL_IMAGE='mcr.microsoft.com/azure-sql-edge'
fi
# tear down databases beforehand
docker compose rm -svf citus mssql postgres
docker compose up hge-build tests-py