2021-05-25 16:54:18 +03:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
PARAMS=""
|
2021-06-09 12:50:02 +03:00
|
|
|
BACKEND="${BACKEND:-postgres}"
|
2021-05-25 16:54:18 +03:00
|
|
|
|
|
|
|
die_backends() {
|
|
|
|
cat <<EOL
|
|
|
|
Invalid --backend argument. Available backends:
|
|
|
|
postgres (default)
|
|
|
|
bigquery
|
|
|
|
citus
|
|
|
|
mssql
|
2021-07-21 20:22:08 +03:00
|
|
|
mysql
|
2021-05-25 16:54:18 +03:00
|
|
|
|
|
|
|
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)
|
2021-07-06 14:12:18 +03:00
|
|
|
# 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")
|
2021-05-25 16:54:18 +03:00
|
|
|
;;
|
|
|
|
citus)
|
|
|
|
;;
|
|
|
|
mssql)
|
|
|
|
;;
|
2021-07-21 20:22:08 +03:00
|
|
|
mysql)
|
|
|
|
;;
|
2021-05-25 16:54:18 +03:00
|
|
|
*)
|
|
|
|
die_backends
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
# set positional arguments in their proper place
|
|
|
|
eval set -- "$PARAMS"
|
|
|
|
export BACKEND
|