16561: Handle implicit port number in ws:// and wss:// urls.
[arvados.git] / lib / controller / server_test.go
index 838de35563e60fb1a994e8cee8c28dd2b9321fbe..4f3d4a56834dad539363be635718ca3b0758d3b5 100644 (file)
@@ -6,9 +6,11 @@ package controller
 
 import (
        "context"
+       "net"
        "net/http"
        "os"
        "path/filepath"
+       "time"
 
        "git.arvados.org/arvados.git/sdk/go/arvados"
        "git.arvados.org/arvados.git/sdk/go/arvadostest"
@@ -33,21 +35,25 @@ func integrationTestCluster() *arvados.Cluster {
 // provided by the integration-testing environment.
 func newServerFromIntegrationTestEnv(c *check.C) *httpserver.Server {
        log := ctxlog.TestLogger(c)
-
-       handler := &Handler{Cluster: &arvados.Cluster{
-               ClusterID:        "zzzzz",
-               PostgreSQL:       integrationTestCluster().PostgreSQL,
-               ForceLegacyAPI14: forceLegacyAPI14,
-       }}
+       ctx := ctxlog.Context(context.Background(), log)
+       handler := &Handler{
+               Cluster: &arvados.Cluster{
+                       ClusterID:  "zzzzz",
+                       PostgreSQL: integrationTestCluster().PostgreSQL,
+               },
+               BackgroundContext: ctx,
+       }
        handler.Cluster.TLS.Insecure = true
+       handler.Cluster.Collections.BlobSigning = true
+       handler.Cluster.Collections.BlobSigningKey = arvadostest.BlobSigningKey
+       handler.Cluster.Collections.BlobSigningTTL = arvados.Duration(time.Hour * 24 * 14)
        arvadostest.SetServiceURL(&handler.Cluster.Services.RailsAPI, "https://"+os.Getenv("ARVADOS_TEST_API_HOST"))
        arvadostest.SetServiceURL(&handler.Cluster.Services.Controller, "http://localhost:/")
 
        srv := &httpserver.Server{
                Server: http.Server{
-                       Handler: httpserver.HandlerWithContext(
-                               ctxlog.Context(context.Background(), log),
-                               httpserver.AddRequestIDs(httpserver.LogRequests(handler))),
+                       BaseContext: func(net.Listener) context.Context { return ctx },
+                       Handler:     httpserver.AddRequestIDs(httpserver.LogRequests(handler)),
                },
                Addr: ":",
        }