mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-15 17:31:56 +03:00
c3afa0fdd7
This installs the ODBC Driver 18 for SQL Server in all our shipped Docker images, and update our tests and documentation accordingly. This version supports arm64, and therefore can run natively (or via Docker) on macOS on aarch64. `msodbcsql17` is still installed in production-targeted Docker images so that users do not _have_ to migrate to the new driver. Nix expressions are packaged for the new driver, as it is not yet available in nixpkgs. In this version, [the default encryption setting was changed from "no" to "yes"](https://techcommunity.microsoft.com/t5/sql-server-blog/odbc-driver-18-0-for-sql-server-released/ba-p/3169228). In addition, "mandatory" and "optional" were added as synonyms for "yes" and "no" respectively. I have therefore modified all connection strings in tests to specify `Encrypt=optional` (and changed some from `Encrypt=no`). I chose "optional" rather than "no" because I feel it's more honest; these connection strings will work with or without an encrypted connection. PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6241 GitOrigin-RevId: 959f88dd1f271ef06a3616bc46b358f364f6cdfd
59 lines
2.1 KiB
Bash
Executable File
59 lines
2.1 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]}")"
|
|
|
|
DATABASES=(citus mssql mssql-healthcheck postgres)
|
|
|
|
(
|
|
cd ../..
|
|
echo '*** Building HGE ***'
|
|
cabal build -j graphql-engine:exe:graphql-engine
|
|
|
|
echo
|
|
echo '*** Installing test dependencies ***'
|
|
make server/tests-py/.hasura-dev-python-venv server/tests-py/node_modules remove-tix-file
|
|
)
|
|
|
|
# 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
|
|
|
|
echo
|
|
echo '*** Pulling images ***'
|
|
docker compose pull "${DATABASES[@]}"
|
|
|
|
echo
|
|
echo '*** Starting databases ***'
|
|
docker compose rm -svf "${DATABASES[@]}" # tear down databases beforehand
|
|
docker compose up -d --wait "${DATABASES[@]}"
|
|
|
|
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 18 for SQL Server};SERVER=localhost,$(docker compose port mssql 1433 | sed -E 's/.*://');Uid=sa;Pwd=Password!;Encrypt=optional"
|
|
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
|
|
|
|
echo
|
|
echo '*** Running tests ***'
|
|
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" \
|
|
"$@"
|