Merge branch 'wtsi/python-api-timeout' refs #13542
[arvados.git] / lib / controller / server_test.go
index 55329656c749e1c929fa60a1a3fd052f05139a95..7742cf4eae6979c6daefb30afd32601b3ce637c0 100644 (file)
@@ -5,8 +5,10 @@
 package controller
 
 import (
+       "bytes"
        "net/http"
        "os"
+       "path/filepath"
 
        "git.curoverse.com/arvados.git/sdk/go/arvados"
        "git.curoverse.com/arvados.git/sdk/go/httpserver"
@@ -21,10 +23,22 @@ type logWriter struct {
 }
 
 func (tl *logWriter) Write(buf []byte) (int, error) {
-       tl.logfunc(string(buf))
+       tl.logfunc(string(bytes.TrimRight(buf, "\n")))
        return len(buf), nil
 }
 
+func integrationTestCluster() *arvados.Cluster {
+       cfg, err := arvados.GetConfig(filepath.Join(os.Getenv("WORKSPACE"), "tmp", "arvados.yml"))
+       if err != nil {
+               panic(err)
+       }
+       cc, err := cfg.GetCluster("zzzzz")
+       if err != nil {
+               panic(err)
+       }
+       return cc
+}
+
 // Return a new unstarted controller server, using the Rails API
 // provided by the integration-testing environment.
 func newServerFromIntegrationTestEnv(c *check.C) *httpserver.Server {
@@ -34,10 +48,11 @@ func newServerFromIntegrationTestEnv(c *check.C) *httpserver.Server {
 
        nodeProfile := arvados.NodeProfile{
                Controller: arvados.SystemServiceInstance{Listen: ":"},
-               RailsAPI:   arvados.SystemServiceInstance{Listen: os.Getenv("ARVADOS_TEST_API_HOST"), TLS: true},
+               RailsAPI:   arvados.SystemServiceInstance{Listen: os.Getenv("ARVADOS_TEST_API_HOST"), TLS: true, Insecure: true},
        }
        handler := &Handler{Cluster: &arvados.Cluster{
-               ClusterID: "zzzzz",
+               ClusterID:  "zzzzz",
+               PostgreSQL: integrationTestCluster().PostgreSQL,
                NodeProfiles: map[string]arvados.NodeProfile{
                        "*": nodeProfile,
                },