1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
15 "git.arvados.org/arvados.git/sdk/go/arvados"
16 "git.arvados.org/arvados.git/sdk/go/arvadostest"
17 "git.arvados.org/arvados.git/sdk/go/ctxlog"
18 "git.arvados.org/arvados.git/sdk/go/httpserver"
19 check "gopkg.in/check.v1"
22 func integrationTestCluster() *arvados.Cluster {
23 cfg, err := arvados.GetConfig(filepath.Join(os.Getenv("WORKSPACE"), "tmp", "arvados.yml"))
27 cc, err := cfg.GetCluster("zzzzz")
34 // Return a new unstarted controller server, using the Rails API
35 // provided by the integration-testing environment.
36 func newServerFromIntegrationTestEnv(c *check.C) *httpserver.Server {
37 log := ctxlog.TestLogger(c)
39 handler := &Handler{Cluster: &arvados.Cluster{
41 PostgreSQL: integrationTestCluster().PostgreSQL,
43 handler.Cluster.TLS.Insecure = true
44 handler.Cluster.Collections.BlobSigning = true
45 handler.Cluster.Collections.BlobSigningKey = arvadostest.BlobSigningKey
46 handler.Cluster.Collections.BlobSigningTTL = arvados.Duration(time.Hour * 24 * 14)
47 arvadostest.SetServiceURL(&handler.Cluster.Services.RailsAPI, "https://"+os.Getenv("ARVADOS_TEST_API_HOST"))
48 arvadostest.SetServiceURL(&handler.Cluster.Services.Controller, "http://localhost:/")
50 srv := &httpserver.Server{
52 BaseContext: func(net.Listener) context.Context {
53 return ctxlog.Context(context.Background(), log)
55 Handler: httpserver.AddRequestIDs(httpserver.LogRequests(handler)),