From f9b64b7d7c95e8a7039a2d5e7a11620e300956dc Mon Sep 17 00:00:00 2001 From: Antoine Leblanc Date: Tue, 30 Nov 2021 16:36:14 +0000 Subject: [PATCH] Fix some dev.sh issues ### Description This PR fixes two small issues with the `dev.sh` script: - when running the script without a specific test flag (`./scripts/dev.sh test`), we would start some of the containers more than once; this PR fixes this by checking whether the container is already running before starting it - we were still doing some bigquery setup in the main code, despite that setup being already done in `parse-pytest-backend`, which would result in biquery setup errors even when testing non-bigquery backends; this PR just deletes the redundant line. PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3017 GitOrigin-RevId: 86a53b1fe974aae733a02bdf045389a0d7436cb7 --- scripts/dev.sh | 50 ++++++++++++++++++++++++++++---------------------- 1 file changed, 28 insertions(+), 22 deletions(-) diff --git a/scripts/dev.sh b/scripts/dev.sh index 471f0971356..f3f404a565c 100755 --- a/scripts/dev.sh +++ b/scripts/dev.sh @@ -194,40 +194,47 @@ function cleanup { trap cleanup EXIT function pg_start() { - pg_launch_container - PG_RUNNING=1 - pg_wait + if [ $PG_RUNNING -eq 0 ]; then + pg_launch_container + PG_RUNNING=1 + pg_wait + fi } function mssql_start() { - mssql_launch_container - MSSQL_RUNNING=1 - if [[ `uname -m` == 'arm64' ]]; then - # mssql_wait uses the tool sqlcmd to wait for a database connection which unfortunately - # is not available for the azure-sql-edge docker image - which is the only image from microsoft - # that runs on M1 computers. So we sleep for 20 seconds, cross fingers and hope for the best - # see https://github.com/microsoft/mssql-docker/issues/668 + if [ $MSSQL_RUNNING -eq 0 ]; then + mssql_launch_container + MSSQL_RUNNING=1 + if [[ `uname -m` == 'arm64' ]]; then + # mssql_wait uses the tool sqlcmd to wait for a database connection which unfortunately + # is not available for the azure-sql-edge docker image - which is the only image from microsoft + # that runs on M1 computers. So we sleep for 20 seconds, cross fingers and hope for the best + # see https://github.com/microsoft/mssql-docker/issues/668 - echo "Sleeping for 20 sec while mssql comes up..." - sleep 20 - else - mssql_wait + echo "Sleeping for 20 sec while mssql comes up..." + sleep 20 + else + mssql_wait + fi fi } function citus_start() { - citus_launch_container - CITUS_RUNNING=1 - citus_wait + if [ $CITUS_RUNNING -eq 0 ]; then + citus_launch_container + CITUS_RUNNING=1 + citus_wait + fi } function mysql_start() { - mysql_launch_container - MYSQL_RUNNING=1 - mysql_wait + if [ $MYSQL_RUNNING -eq 0 ]; then + mysql_launch_container + MYSQL_RUNNING=1 + mysql_wait + fi } - function start_dbs() { # always launch the postgres container pg_start @@ -518,7 +525,6 @@ elif [ "$MODE" = "test" ]; then echo "" echo " Ok" - export HASURA_BIGQUERY_SERVICE_ACCOUNT=$(cat "$HASURA_BIGQUERY_SERVICE_ACCOUNT_FILE") add_sources $HASURA_GRAPHQL_SERVER_PORT cd "$PROJECT_ROOT/server/tests-py"