mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-16 18:42:30 +03:00
8cb2738cbe
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
45 lines
1.8 KiB
Bash
Executable File
45 lines
1.8 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
# This allows a developer to easily run the Python integration tests using the
|
|
# `--hge-bin` flag.
|
|
#
|
|
# The Pytest runner will start a new HGE instance for each test class, with the
|
|
# default arguments and the environment variables provided below.
|
|
#
|
|
# This is a work in progress.
|
|
|
|
set -e
|
|
set -u
|
|
set -o pipefail
|
|
|
|
cd -- "$(dirname -- "${BASH_SOURCE[0]}")"
|
|
|
|
(
|
|
cd ../..
|
|
cabal build graphql-engine:exe:graphql-engine
|
|
make server/tests-py/.hasura-dev-python-venv server/tests-py/node_modules
|
|
)
|
|
|
|
# shellcheck disable=SC1091
|
|
source .hasura-dev-python-venv/bin/activate
|
|
|
|
# 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
|
|
|
|
docker compose rm -svf citus mssql postgres
|
|
docker compose up -d citus mssql-healthcheck postgres-healthy
|
|
|
|
HASURA_GRAPHQL_CITUS_SOURCE_URL="postgresql://postgres:hasura@localhost:$(docker compose port citus 5432 | sed -E 's/.*://')/postgres"
|
|
HASURA_GRAPHQL_MSSQL_SOURCE_URL="DRIVER={ODBC Driver 17 for SQL Server};SERVER=localhost,$(docker compose port mssql 1433 | sed -E 's/.*://');Uid=sa;Pwd=Password!;"
|
|
HASURA_GRAPHQL_PG_SOURCE_URL_1="postgresql://postgres:hasura@localhost:$(docker compose port --index 1 postgres 5432 | sed -E 's/.*://')/postgres"
|
|
HASURA_GRAPHQL_PG_SOURCE_URL_2="postgresql://postgres:hasura@localhost:$(docker compose port --index 2 postgres 5432 | sed -E 's/.*://')/postgres"
|
|
export HASURA_GRAPHQL_CITUS_SOURCE_URL HASURA_GRAPHQL_MSSQL_SOURCE_URL HASURA_GRAPHQL_PG_SOURCE_URL_1 HASURA_GRAPHQL_PG_SOURCE_URL_2
|
|
|
|
pytest \
|
|
--hge-bin="$(cabal list-bin graphql-engine:exe:graphql-engine)" \
|
|
--pg-urls "$HASURA_GRAPHQL_PG_SOURCE_URL_1" "$HASURA_GRAPHQL_PG_SOURCE_URL_2" \
|
|
"$@"
|