[ARVADOS] updated: 7b9ca2a26b4099e45548d83fc878fe295f2cdc56

git at public.curoverse.com git at public.curoverse.com
Thu Feb 5 17:03:29 EST 2015


Summary of changes:
 sdk/go/arvadosclient/arvadosclient_test.go |  2 +-
 sdk/python/tests/run_test_server.py        | 33 +++++++++++++++++-------------
 2 files changed, 20 insertions(+), 15 deletions(-)

       via  7b9ca2a26b4099e45548d83fc878fe295f2cdc56 (commit)
       via  7acac83d2789b36f0e249a3fde9a8d300f15e152 (commit)
       via  dac304f927000b74d41defcdea26da5d896bfc0c (commit)
      from  b20590222beddb52c8c89294ed3a324c8c7190a2 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit 7b9ca2a26b4099e45548d83fc878fe295f2cdc56
Author: Tom Clegg <tom at curoverse.com>
Date:   Thu Feb 5 17:02:45 2015 -0500

    3021: Give up earlier if ARVADOS_TEST_API_HOST is set but reset() fails.

diff --git a/sdk/python/tests/run_test_server.py b/sdk/python/tests/run_test_server.py
index b5536da..19520c8 100644
--- a/sdk/python/tests/run_test_server.py
+++ b/sdk/python/tests/run_test_server.py
@@ -143,19 +143,22 @@ def run(leave_running_atexit=False):
 
     existing_api_host = os.environ.get('ARVADOS_TEST_API_HOST', my_api_host)
     if existing_api_host and pid_file_ok:
-        try:
-            reset()
-            return
-        except:
-            pass
+        if existing_api_host == my_api_host:
+            try:
+                return reset()
+            except:
+                # Fall through to shutdown-and-start case.
+                pass
+        else:
+            # Server was provided by parent. Can't recover if it's
+            # unresettable.
+            return reset()
 
     # Before trying to start up our own server, call stop() to avoid
     # "Phusion Passenger Standalone is already running on PID 12345".
-    # We want to kill it if it's our own _or_ it's some stale
-    # left-over server. But if it's been deliberately provided to us
-    # by a parent process, we don't want to force-kill it. That'll
-    # just wreck things for the next test suite that tries to use it.
-    stop(force=('ARVADOS_TEST_API_HOST' not in os.environ))
+    # (If we've gotten this far, ARVADOS_TEST_API_HOST isn't set, so
+    # we know the server is ours to kill.)
+    stop(force=True)
 
     restore_cwd = os.getcwd()
     api_src_dir = os.path.join(SERVICES_SRC_DIR, 'api')

commit 7acac83d2789b36f0e249a3fde9a8d300f15e152
Author: Tom Clegg <tom at curoverse.com>
Date:   Thu Feb 5 17:02:16 2015 -0500

    3021: Reset env vars in any reset(), not just in start().

diff --git a/sdk/python/tests/run_test_server.py b/sdk/python/tests/run_test_server.py
index ab1c7ff..b5536da 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.

commit dac304f927000b74d41defcdea26da5d896bfc0c
Author: Tom Clegg <tom at curoverse.com>
Date:   Thu Feb 5 16:29:27 2015 -0500

    3021: Set env var to empty string instead of removing it. Unsetenv isn't worth introducing a dependency on Go 1.4.

diff --git a/sdk/go/arvadosclient/arvadosclient_test.go b/sdk/go/arvadosclient/arvadosclient_test.go
index d8bec39..1af964d 100644
--- a/sdk/go/arvadosclient/arvadosclient_test.go
+++ b/sdk/go/arvadosclient/arvadosclient_test.go
@@ -28,7 +28,7 @@ func (s *ServerRequiredSuite) SetUpTest(c *C) {
 }
 
 func (s *ServerRequiredSuite) TestMakeArvadosClientSecure(c *C) {
-	os.Unsetenv("ARVADOS_API_HOST_INSECURE")
+	os.Setenv("ARVADOS_API_HOST_INSECURE", "")
 	kc, err := MakeArvadosClient()
 	c.Assert(err, Equals, nil)
 	c.Check(kc.ApiServer, Equals, os.Getenv("ARVADOS_API_HOST"))

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list