Merge branch 'master' into 14715-keepprox-config
[arvados.git] / sdk / python / tests / run_test_server.py
index 81c1b841230376db1d995058124444d47b314063..e79b4843a268049e117d60e59a37a8de62e61fbb 100644 (file)
@@ -544,10 +544,11 @@ def run_keep_proxy():
     env['ARVADOS_API_TOKEN'] = auth_token('anonymous')
     logf = open(_logfilename('keepproxy'), 'a')
     kp = subprocess.Popen(
-        ['keepproxy',
-         '-pid='+_pidfile('keepproxy'),
-         '-listen=:{}'.format(port)],
-        env=env, stdin=open('/dev/null'), stdout=logf, stderr=logf, close_fds=True)
+        ['keepproxy'], env=env, stdin=open('/dev/null'), stdout=logf, stderr=logf, close_fds=True)
+
+    with open(_pidfile('keepproxy'), 'w') as f:
+        f.write(str(kp.pid))
+    _wait_until_port_listens(port)
 
     print("Using API %s token %s" % (os.environ['ARVADOS_API_HOST'], auth_token('admin')), file=sys.stdout)
     api = arvados.api(
@@ -604,14 +605,9 @@ def run_keep_web():
 
     keepwebport = internal_port_from_config("WebDAV")
     env = os.environ.copy()
-    env['ARVADOS_API_TOKEN'] = auth_token('anonymous')
     logf = open(_logfilename('keep-web'), 'a')
     keepweb = subprocess.Popen(
-        ['keep-web',
-         '-allow-anonymous',
-         '-attachment-only-host=download',
-         '-management-token=e687950a23c3a9bceec28c6223a06c79',
-         '-listen=:'+str(keepwebport)],
+        ['keep-web'],
         env=env, stdin=open('/dev/null'), stdout=logf, stderr=logf)
     with open(_pidfile('keep-web'), 'w') as f:
         f.write(str(keepweb.pid))
@@ -677,55 +673,56 @@ def setup_config():
     keep_web_dl_port = find_available_port()
     keep_web_dl_external_port = find_available_port()
 
-    if "CONFIGSRC" in os.environ:
-        dbconf = os.path.join(os.environ["CONFIGSRC"], "config.yml")
-    else:
-        dbconf = "/etc/arvados/config.yml"
+    dbconf = os.path.join(os.environ["CONFIGSRC"], "config.yml")
 
     print("Getting config from %s" % dbconf, file=sys.stderr)
 
-    pgconnection = list(yaml.safe_load(open(dbconf))["Clusters"].values())[0]["PostgreSQL"]["Connection"]
-
-    if "test" not in pgconnection["dbname"]:
-        pgconnection["dbname"] = "arvados_test"
+    pgconnection = yaml.safe_load(open(dbconf))["Clusters"]["zzzzz"]["PostgreSQL"]["Connection"]
 
     localhost = "127.0.0.1"
     services = {
         "RailsAPI": {
-            "InternalURLs": { }
+            "InternalURLs": {
+                "https://%s:%s"%(localhost, rails_api_port): {}
+            }
         },
         "Controller": {
             "ExternalURL": "https://%s:%s" % (localhost, controller_external_port),
-            "InternalURLs": { }
+            "InternalURLs": {
+                "http://%s:%s"%(localhost, controller_port): {}
+            }
         },
         "Websocket": {
             "ExternalURL": "wss://%s:%s/websocket" % (localhost, websocket_external_port),
-            "InternalURLs": { }
+            "InternalURLs": {
+                "http://%s:%s"%(localhost, websocket_port): {}
+            }
         },
         "GitHTTP": {
             "ExternalURL": "https://%s:%s" % (localhost, git_httpd_external_port),
-            "InternalURLs": { }
+            "InternalURLs": {
+                "http://%s:%s"%(localhost, git_httpd_port): {}
+            }
         },
         "Keepproxy": {
             "ExternalURL": "https://%s:%s" % (localhost, keepproxy_external_port),
-            "InternalURLs": { }
+            "InternalURLs": {
+                "http://%s:%s"%(localhost, keepproxy_port): {}
+            }
         },
         "WebDAV": {
             "ExternalURL": "https://%s:%s" % (localhost, keep_web_external_port),
-            "InternalURLs": { }
+            "InternalURLs": {
+                "http://%s:%s"%(localhost, keep_web_port): {}
+            }
         },
         "WebDAVDownload": {
             "ExternalURL": "https://%s:%s" % (localhost, keep_web_dl_external_port),
-            "InternalURLs": { }
+            "InternalURLs": {
+                "http://%s:%s"%(localhost, keep_web_dl_port): {}
+            }
         }
     }
-    services["RailsAPI"]["InternalURLs"]["https://%s:%s"%(localhost, rails_api_port)] = {}
-    services["Controller"]["InternalURLs"]["http://%s:%s"%(localhost, controller_port)] = {}
-    services["Websocket"]["InternalURLs"]["http://%s:%s"%(localhost, websocket_port)] = {}
-    services["GitHTTP"]["InternalURLs"]["http://%s:%s"%(localhost, git_httpd_port)] = {}
-    services["Keepproxy"]["InternalURLs"]["http://%s:%s"%(localhost, keepproxy_port)] = {}
-    services["WebDAV"]["InternalURLs"]["http://%s:%s"%(localhost, keep_web_port)] = {}
-    services["WebDAVDownload"]["InternalURLs"]["http://%s:%s"%(localhost, keep_web_dl_port)] = {}
 
     config = {
         "Clusters": {
@@ -744,7 +741,13 @@ def setup_config():
                 "TLS": {
                     "Insecure": True
                 },
-                "Services": services
+                "Services": services,
+                "Users": {
+                    "AnonymousUserToken": auth_token('anonymous')
+                },
+                "Collections": {
+                    "TrustAllContent": True
+                }
             }
         }
     }
@@ -754,7 +757,6 @@ def setup_config():
         yaml.safe_dump(config, f)
 
     ex = "export ARVADOS_CONFIG="+conf
-    print(ex, file=sys.stderr)
     print(ex)