graphql-engine/scripts/parse-pytest-backend

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

56 lines
770 B
Plaintext
Raw Normal View History

#!/usr/bin/env bash
PARAMS=""
BACKEND="${BACKEND:-postgres}"
die_backends() {
cat <<EOL
Invalid --backend argument. Available backends:
postgres (default)
bigquery
citus
mssql
mysql
EOL
exit 1
}
while (( "$#" )); do
case "$1" in
--backend)
if [ -n "$2" ] && [ "${2:0:1}" != "-" ]; then
BACKEND=$2
shift 2
fi
;;
*) # preserve positional arguments
PARAMS="$PARAMS $1"
shift
;;
esac
done
# validate backend argument
case "$BACKEND" in
postgres)
;;
bigquery)
server/tests: ephemeral BigQuery projects for CI test jobs _Problem_ We currently run teardown/`DELETE` statements on the same, shared `hasura_test` dataset. This is not ideal as parallel test runs can and do affect each other, resulting in nondeterministic CI failures. Closes https://github.com/hasura/graphql-engine-mono/issues/2521 _Solution and design_ This PR introduces ephemeral, isolated projects for each test run _in CI only_. Projects are created within [the Google Cloud Platform `data-sources-test-bigquery` directory](https://console.cloud.google.com/iam-admin/settings?folder=704256416468&orgonly=true&supportedpurview=organizationId) on each test run, and destroyed afterwards. I've only introduced this change in CI for the time being: 1. this isn't as much of an issue locally because we're less likely to run bigquery tests in parallel. 2. to more quickly unblock https://github.com/hasura/graphql-engine/issues/7929. 3. to limit the number of new projects created until we have a better idea of our usage vs GCP quota/limits. Also updated the [internal wiki here](https://github.com/hasura/graphql-engine-mono/wiki/Testing-BigQuery) with this info. _To verify_ - CI: [this job](https://buildkite.com/hasura/graphql-engine-mono/builds/3770#89e5bac6-16fe-447e-bcda-85cd47ea1b77) successfully runs all tests on a temporary project & dataset - local: follow [these steps](https://github.com/hasura/graphql-engine-mono/wiki/Testing-BigQuery#ci--optional-dedicated-gcp-project-for-tests) to try the same setup locally PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3240 GitOrigin-RevId: d88d9cb7922266bfa962cfcb481e0272b8929a5d
2022-01-25 11:26:32 +03:00
source "scripts/bigquery.sh"
verify_bigquery_pytest_env
;;
citus)
;;
mssql)
;;
mysql)
;;
*)
die_backends
;;
esac
# set positional arguments in their proper place
eval set -- "$PARAMS"
export BACKEND