From aeeb1f6f7f11cbee30603284c594aab89c7fc610 Mon Sep 17 00:00:00 2001 From: Tom Clegg Date: Thu, 19 Mar 2020 13:34:35 -0400 Subject: [PATCH] 16053: Make CONFIGSRC optional again. Arvados-DCO-1.1-Signed-off-by: Tom Clegg --- build/run-tests.sh | 8 +++----- sdk/python/tests/run_test_server.py | 20 +++++++++++++++----- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/build/run-tests.sh b/build/run-tests.sh index f5c184e492..4e8254b729 100755 --- a/build/run-tests.sh +++ b/build/run-tests.sh @@ -35,7 +35,7 @@ Options: --short Skip (or scale down) some slow tests. --interactive Set up, then prompt for test/install steps to perform. WORKSPACE=path Arvados source tree to test. -CONFIGSRC=path Dir with config.yml file containing PostgreSQL section for use by tests. (required) +CONFIGSRC=path Dir with config.yml file containing PostgreSQL section for use by tests. services/api_test="TEST=test/functional/arvados/v1/collections_controller_test.rb" Restrict apiserver tests to the given file sdk/python_test="--test-suite tests.test_keep_locator" @@ -197,10 +197,8 @@ sanity_checks() { [[ -n "${skip[sanity]}" ]] && return 0 ( [[ -n "$WORKSPACE" ]] && [[ -d "$WORKSPACE/services" ]] ) \ || fatal "WORKSPACE environment variable not set to a source directory (see: $0 --help)" - [[ -n "$CONFIGSRC" ]] \ - || fatal "CONFIGSRC environment not set (see: $0 --help)" - [[ -s "$CONFIGSRC/config.yml" ]] \ - || fatal "'$CONFIGSRC/config.yml' is empty or not found (see: $0 --help)" + [[ -z "$CONFIGSRC" ]] || [[ -s "$CONFIGSRC/config.yml" ]] \ + || fatal "CONFIGSRC is $CONFIGSRC but '$CONFIGSRC/config.yml' is empty or not found (see: $0 --help)" echo Checking dependencies: echo "locale: ${LANG}" [[ "$(locale charmap)" = "UTF-8" ]] \ diff --git a/sdk/python/tests/run_test_server.py b/sdk/python/tests/run_test_server.py index 262b9d2a2c..f5ee9c3832 100644 --- a/sdk/python/tests/run_test_server.py +++ b/sdk/python/tests/run_test_server.py @@ -661,11 +661,21 @@ def setup_config(): keep_web_dl_port = find_available_port() keep_web_dl_external_port = find_available_port() - dbconf = os.path.join(os.environ["CONFIGSRC"], "config.yml") - - print("Getting config from %s" % dbconf, file=sys.stderr) - - pgconnection = yaml.safe_load(open(dbconf))["Clusters"]["zzzzz"]["PostgreSQL"]["Connection"] + configsrc = os.environ.get("CONFIGSRC", None) + if configsrc: + clusterconf = os.path.join(configsrc, "config.yml") + print("Getting config from %s" % clusterconf, file=sys.stderr) + pgconnection = yaml.safe_load(open(clusterconf))["Clusters"]["zzzzz"]["PostgreSQL"]["Connection"] + else: + # assume "arvados-server install -type test" has set up the + # conventional db credentials + pgconnection = { + "client_encoding": "utf8", + "host": "localhost", + "dbname": "arvados_test", + "user": "arvados", + "password": "insecure_arvados_test", + } localhost = "127.0.0.1" services = { -- 2.30.2