X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/91b39ff3fbba69e54a330a7949c9ed4bbb3117ff..451559bf80f31f57ac6937e79e4d37633b9eafa3:/lib/controller/server_test.go diff --git a/lib/controller/server_test.go b/lib/controller/server_test.go index ae89c3d7ea..4f3d4a5683 100644 --- a/lib/controller/server_test.go +++ b/lib/controller/server_test.go @@ -5,13 +5,17 @@ package controller import ( + "context" + "net" "net/http" "os" "path/filepath" + "time" - "git.curoverse.com/arvados.git/sdk/go/arvados" - "git.curoverse.com/arvados.git/sdk/go/ctxlog" - "git.curoverse.com/arvados.git/sdk/go/httpserver" + "git.arvados.org/arvados.git/sdk/go/arvados" + "git.arvados.org/arvados.git/sdk/go/arvadostest" + "git.arvados.org/arvados.git/sdk/go/ctxlog" + "git.arvados.org/arvados.git/sdk/go/httpserver" check "gopkg.in/check.v1" ) @@ -31,24 +35,27 @@ func integrationTestCluster() *arvados.Cluster { // provided by the integration-testing environment. func newServerFromIntegrationTestEnv(c *check.C) *httpserver.Server { log := ctxlog.TestLogger(c) - - nodeProfile := arvados.NodeProfile{ - Controller: arvados.SystemServiceInstance{Listen: ":"}, - RailsAPI: arvados.SystemServiceInstance{Listen: os.Getenv("ARVADOS_TEST_API_HOST"), TLS: true, Insecure: true}, - } - handler := &Handler{Cluster: &arvados.Cluster{ - ClusterID: "zzzzz", - PostgreSQL: integrationTestCluster().PostgreSQL, - NodeProfiles: map[string]arvados.NodeProfile{ - "*": nodeProfile, + ctx := ctxlog.Context(context.Background(), log) + handler := &Handler{ + Cluster: &arvados.Cluster{ + ClusterID: "zzzzz", + PostgreSQL: integrationTestCluster().PostgreSQL, }, - }, NodeProfile: &nodeProfile} + 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.AddRequestIDs(httpserver.LogRequests(log, handler)), + BaseContext: func(net.Listener) context.Context { return ctx }, + Handler: httpserver.AddRequestIDs(httpserver.LogRequests(handler)), }, - Addr: nodeProfile.Controller.Listen, + Addr: ":", } return srv }