14291: Support EBS attached storage and preemptible instances
[arvados.git] / services / arv-git-httpd / integration_test.go
index 61d83ff8e85a0da8b6579b8a86ffd8c50d5b2551..10c69eedd3bf2e2c81cb51ea7c92961d108f1204 100644 (file)
@@ -1,3 +1,7 @@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
 package main
 
 import (
@@ -8,6 +12,7 @@ import (
        "strings"
        "testing"
 
+       "git.curoverse.com/arvados.git/sdk/go/arvados"
        "git.curoverse.com/arvados.git/sdk/go/arvadostest"
        check "gopkg.in/check.v1"
 )
@@ -23,7 +28,7 @@ type IntegrationSuite struct {
        tmpRepoRoot string
        tmpWorkdir  string
        testServer  *server
-       Config      *config
+       Config      *Config
 }
 
 func (s *IntegrationSuite) SetUpSuite(c *check.C) {
@@ -67,19 +72,28 @@ func (s *IntegrationSuite) SetUpTest(c *check.C) {
        c.Assert(err, check.Equals, nil)
 
        if s.Config == nil {
-               s.Config = &config{
-                       Addr:       ":0",
-                       GitCommand: "/usr/bin/git",
-                       Root:       s.tmpRepoRoot,
+               s.Config = &Config{
+                       Client: arvados.Client{
+                               APIHost:  arvadostest.APIHost(),
+                               Insecure: true,
+                       },
+                       Listen:          ":0",
+                       GitCommand:      "/usr/bin/git",
+                       RepoRoot:        s.tmpRepoRoot,
+                       ManagementToken: arvadostest.ManagementToken,
                }
        }
+
+       // Clear ARVADOS_API_* env vars before starting up the server,
+       // to make sure arv-git-httpd doesn't use them or complain
+       // about them being missing.
+       os.Unsetenv("ARVADOS_API_HOST")
+       os.Unsetenv("ARVADOS_API_HOST_INSECURE")
+       os.Unsetenv("ARVADOS_API_TOKEN")
+
        theConfig = s.Config
        err = s.testServer.Start()
        c.Assert(err, check.Equals, nil)
-
-       // Clear ARVADOS_API_TOKEN after starting up the server, to
-       // make sure arv-git-httpd doesn't use it.
-       os.Setenv("ARVADOS_API_TOKEN", "unused-token-placates-client-library")
 }
 
 func (s *IntegrationSuite) TearDownTest(c *check.C) {
@@ -103,6 +117,8 @@ func (s *IntegrationSuite) TearDownTest(c *check.C) {
        s.tmpWorkdir = ""
 
        s.Config = nil
+
+       theConfig = defaultConfig()
 }
 
 func (s *IntegrationSuite) RunGit(c *check.C, token, gitCmd, repo string, args ...string) error {