server/tests-py: Fix the run.sh and run-new.sh scripts to work with our new server-builder image.

This updates _docker-compose.yml_ to use the new image tags, and updates _run.sh_ accordingly.

While I was at it, I also added a `docker compose pull` instruction to make sure that we don't have surprises half-way through the script, and a few `echo` lines for clarity.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6235
GitOrigin-RevId: 3855f6898bd3e906c5f423d9d0d6a7031de3777a
This commit is contained in:
Samir Talwar 2022-10-06 21:03:40 +02:00 committed by hasura-bot
parent f9ff7ae00c
commit 36031d62d2
3 changed files with 31 additions and 5 deletions

View File

@ -4,7 +4,7 @@ version: "3.6"
services:
cabal-update:
image: hasura/graphql-engine-server-builder:${HASURA_GRAPHQL_ENGINE_SERVER_BUILDER_SHA}
image: hasura/graphql-engine-server-builder:${PLATFORM:-}-${HASURA_GRAPHQL_ENGINE_SERVER_BUILDER_SHA}
command:
- cabal
- update
@ -15,7 +15,7 @@ services:
working_dir: /src
hge-build:
image: hasura/graphql-engine-server-builder:${HASURA_GRAPHQL_ENGINE_SERVER_BUILDER_SHA}
image: hasura/graphql-engine-server-builder:${PLATFORM:-}-${HASURA_GRAPHQL_ENGINE_SERVER_BUILDER_SHA}
command:
- cabal
- build
@ -40,7 +40,7 @@ services:
- CIRCLE_NODE_INDEX=1
- CIRCLE_NODE_TOTAL=1
- OUTPUT_FOLDER=/output
- GRAPHQL_ENGINE=/src/dist-newstyle/build/x86_64-linux/ghc-8.10.7/graphql-engine-1.0.0/x/graphql-engine/noopt/build/graphql-engine/graphql-engine
- GRAPHQL_ENGINE=/src/dist-newstyle/build/x86_64-linux/ghc-9.2.4.20220919/graphql-engine-1.0.0/x/graphql-engine/noopt/build/graphql-engine/graphql-engine
- 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

View File

@ -16,7 +16,11 @@ cd -- "$(dirname -- "${BASH_SOURCE[0]}")"
(
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
)
@ -29,7 +33,13 @@ if [[ "$(uname -m)" == 'arm64' ]]; then
export MSSQL_IMAGE='mcr.microsoft.com/azure-sql-edge'
fi
docker compose rm -svf citus mssql postgres
echo
echo '*** Pulling images ***'
docker compose pull citus mssql postgres
echo
echo '*** Starting databases ***'
docker compose rm -svf citus mssql postgres # tear down databases beforehand
docker compose up -d citus-healthy mssql-healthcheck postgres-healthy
HASURA_GRAPHQL_CITUS_SOURCE_URL="postgresql://postgres:hasura@localhost:$(docker compose port citus 5432 | sed -E 's/.*://')/postgres"
@ -38,6 +48,8 @@ HASURA_GRAPHQL_PG_SOURCE_URL_1="postgresql://postgres:hasura@localhost:$(docker
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" \

View File

@ -16,6 +16,16 @@ set -o pipefail
cd -- "$(dirname -- "${BASH_SOURCE[0]}")"
# This `PLATFORM` value is used to pick the correct server builder image.
PLATFORM="$(uname -m)"
if [[ "$PLATFORM" == 'x86_64' ]]; then
PLATFORM='amd64'
fi
if [[ "$PLATFORM" == 'aarch64' ]]; then
PLATFORM='arm64'
fi
export PLATFORM
# copied from images.go
HASURA_GRAPHQL_ENGINE_SERVER_BUILDER_SHA="$(
sha256sum ../../.buildkite/dockerfiles/ci-builders/server-builder.dockerfile \
@ -48,7 +58,11 @@ else
SERVER_TESTS_TO_RUN=('no-auth')
fi
echo "*** Building HGE ***"
echo '*** Pulling images ***'
docker compose pull
echo
echo '*** Building HGE ***'
docker compose run --rm hge-build
for SERVER_TEST_TO_RUN in "${SERVER_TESTS_TO_RUN[@]}"; do