graphql-engine/scripts/parse-pytest-backend
Abby Sassel 76c322589c server/bigquery: Document BigQuery integration tests
This PR documents & streamlines how we run BigQuery integration tests locally as a first step to [running them in CI](https://github.com/hasura/graphql-engine-mono/issues/1525).

I've also created a hasura service account for internal use. [Internal docs here](https://github.com/hasura/graphql-engine-mono/wiki/Testing-BigQuery).

Thanks to FP Complete team for [the guidance here](https://docs.google.com/document/d/1dGDK0touUtsDxRQPonMxSoPbIfzBoSYo02tAjQEO7qA/edit?ts=60c0cf24#), which I've reused parts of.

https://github.com/hasura/graphql-engine-mono/pull/1732

GitOrigin-RevId: 303819d212aa073fbef685d077b1cfa583cd15fc
2021-07-06 11:13:06 +00:00

58 lines
1.2 KiB
Bash

#!/usr/bin/env bash
PARAMS=""
BACKEND="${BACKEND:-postgres}"
die_backends() {
cat <<EOL
Invalid --backend argument. Available backends:
postgres (default)
bigquery
citus
mssql
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)
# check that required bigquery environment variables are present
if [[ -z "${HASURA_BIGQUERY_SERVICE_ACCOUNT_FILE:-}" || -z "${HASURA_BIGQUERY_PROJECT_ID:-}" ]]; then
echo "HASURA_BIGQUERY_SERVICE_ACCOUNT_FILE and HASURA_BIGQUERY_PROJECT_ID environment variables are needed to run these tests."
echo "See https://github.com/hasura/graphql-engine/blob/master/server/CONTRIBUTING.md#running-the-python-test-suite-on-bigquery for more information."
exit 0
fi
export HASURA_BIGQUERY_SERVICE_ACCOUNT=$(cat "$HASURA_BIGQUERY_SERVICE_ACCOUNT_FILE")
;;
citus)
;;
mssql)
;;
*)
die_backends
;;
esac
# set positional arguments in their proper place
eval set -- "$PARAMS"
export BACKEND