3021: In start(), if a stale server is already running (but we can't reset() it)...
authorTom Clegg <tom@curoverse.com>
Thu, 5 Feb 2015 02:28:52 +0000 (21:28 -0500)
committerTom Clegg <tom@curoverse.com>
Thu, 5 Feb 2015 02:28:52 +0000 (21:28 -0500)
sdk/python/tests/run_test_server.py

index dbad488489e01bb469e0e4c4bcd646bbffc1be4e..ab1c7ffd1a270803e419e98557c0abfd8b40f2e9 100644 (file)
@@ -153,6 +153,14 @@ def run(leave_running_atexit=False):
         except:
             pass
 
+    # 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))
+
     restore_cwd = os.getcwd()
     api_src_dir = os.path.join(SERVICES_SRC_DIR, 'api')
     os.chdir(api_src_dir)