From 7acac83d2789b36f0e249a3fde9a8d300f15e152 Mon Sep 17 00:00:00 2001 From: Tom Clegg Date: Thu, 5 Feb 2015 17:02:16 -0500 Subject: [PATCH] 3021: Reset env vars in any reset(), not just in start(). --- sdk/python/tests/run_test_server.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/sdk/python/tests/run_test_server.py b/sdk/python/tests/run_test_server.py index ab1c7ffd1a..b5536da77c 100644 --- a/sdk/python/tests/run_test_server.py +++ b/sdk/python/tests/run_test_server.py @@ -138,16 +138,12 @@ def run(leave_running_atexit=False): # Delete cached discovery document. shutil.rmtree(arvados.http_cache('discovery')) - os.environ['ARVADOS_API_TOKEN'] = auth_token('admin') - os.environ['ARVADOS_API_HOST_INSECURE'] = 'true' - pid_file = os.path.join(SERVICES_SRC_DIR, 'api', SERVER_PID_PATH) pid_file_ok = find_server_pid(pid_file, 0) existing_api_host = os.environ.get('ARVADOS_TEST_API_HOST', my_api_host) if existing_api_host and pid_file_ok: try: - os.environ['ARVADOS_API_HOST'] = existing_api_host reset() return except: @@ -222,6 +218,9 @@ def reset(): This resets the ARVADOS_TEST_API_HOST provided by a parent process if any, otherwise the server started by run(). + + It also resets ARVADOS_* environment vars to point to the test + server with admin credentials. """ existing_api_host = os.environ.get('ARVADOS_TEST_API_HOST', my_api_host) token = auth_token('admin') @@ -231,6 +230,9 @@ def reset(): 'https://{}/database/reset'.format(existing_api_host), 'POST', headers={'Authorization': 'OAuth2 {}'.format(token)}) + os.environ['ARVADOS_API_HOST_INSECURE'] = 'true' + os.environ['ARVADOS_API_HOST'] = existing_api_host + os.environ['ARVADOS_API_TOKEN'] = token def stop(force=False): """Stop the API server, if one is running. -- 2.30.2