5824: Fix Keep server shutdown, check errors, simplify stderr redirection.
[arvados.git] / sdk / python / tests / run_test_server.py
index b58c6117dd56265b411340c9a700d3a660672817..8d1c2025b543546cf7bc10e4d78c0d1808f07c5b 100644 (file)
@@ -447,11 +447,12 @@ def run_arv_git_httpd():
     gitport = find_available_port()
     env = os.environ.copy()
     env.pop('ARVADOS_API_TOKEN', None)
+    logf = open(_fifo2stderr('arv-git-httpd'), 'w')
     agh = subprocess.Popen(
         ['arv-git-httpd',
          '-repo-root='+gitdir+'/test',
          '-address=:'+str(gitport)],
-        env=env, stdin=open('/dev/null'), stdout=sys.stderr)
+        env=env, stdin=open('/dev/null'), stdout=logf, stderr=logf)
     with open(_pidfile('arv-git-httpd'), 'w') as f:
         f.write(str(agh.pid))
     _setport('arv-git-httpd', gitport)
@@ -469,13 +470,14 @@ def run_keep_web():
 
     keepwebport = find_available_port()
     env = os.environ.copy()
-    env.pop('ARVADOS_API_TOKEN', None)
+    env['ARVADOS_API_TOKEN'] = auth_token('anonymous')
+    logf = open(_fifo2stderr('keep-web'), 'w')
     keepweb = subprocess.Popen(
         ['keep-web',
-         '-anonymous-token='+fixture('api_client_authorizations')['anonymous']['api_token'],
+         '-allow-anonymous',
          '-attachment-only-host=localhost:'+str(keepwebport),
-         '-address=:'+str(keepwebport)],
-        env=env, stdin=open('/dev/null'), stdout=sys.stderr)
+         '-listen=:'+str(keepwebport)],
+        env=env, stdin=open('/dev/null'), stdout=logf, stderr=logf)
     with open(_pidfile('keep-web'), 'w') as f:
         f.write(str(keepweb.pid))
     _setport('keep-web', keepwebport)