mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-15 17:31:56 +03:00
3cb9bab9f1
When we run the HGE server inside the test harness, it needs to run with an admin secret for some tests to make sense. This tags each test that requires an admin secret with `pytest.mark.admin_secret`, which then generates a UUID and injects that into both the server and the test case (if required). It also simplifies the way the test harness picks up an existing admin secret, allowing it to use the environment variable instead of requiring it via a parameter. PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6120 GitOrigin-RevId: 55c5b9e8c99bdad9c8304098444ddb9516749a2c
61 lines
1.8 KiB
Bash
Executable File
61 lines
1.8 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
|
|
|
|
# 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
|
|
|
|
if [[ $# -gt 0 ]]; then
|
|
SERVER_TESTS_TO_RUN=("$@")
|
|
else
|
|
SERVER_TESTS_TO_RUN=('no-auth')
|
|
fi
|
|
|
|
echo "*** Building HGE ***"
|
|
docker compose run --rm hge-build
|
|
|
|
for SERVER_TEST_TO_RUN in "${SERVER_TESTS_TO_RUN[@]}"; do
|
|
export SERVER_TEST_TO_RUN
|
|
echo
|
|
echo "*** Running test suite: ${SERVER_TEST_TO_RUN} ***"
|
|
docker compose rm -svf citus mssql postgres # tear down databases beforehand
|
|
docker compose run --rm tests-py
|
|
done
|