[ARVADOS] updated: 1.3.0-1536-g48d98c75b

Git user git at public.curoverse.com
Mon Aug 26 14:46:30 UTC 2019


Summary of changes:
 services/arv-git-httpd/auth_handler_test.go      | 21 ++++++------
 services/arv-git-httpd/git_handler_test.go       | 24 ++++++++++----
 services/arv-git-httpd/gitolite_test.go          | 24 +++++++-------
 services/arv-git-httpd/integration_test.go       | 41 +++++++++++++-----------
 tools/arvbox/lib/arvbox/docker/cluster-config.sh |  2 +-
 tools/arvbox/lib/arvbox/docker/service/nginx/run |  2 +-
 6 files changed, 65 insertions(+), 49 deletions(-)

       via  48d98c75b63e1543aacc44ddf93caf87493dd9cc (commit)
       via  68e1af73379e045d831583cf452b9ae863dc42cc (commit)
      from  64550043490c47ca6e363e4c77bee30df8fe0de8 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit 48d98c75b63e1543aacc44ddf93caf87493dd9cc
Author: Eric Biagiotti <ebiagiotti at veritasgenetics.com>
Date:   Mon Aug 26 10:44:23 2019 -0400

    14712: Fixes tests
    
    Arvados-DCO-1.1-Signed-off-by: Eric Biagiotti <ebiagiotti at veritasgenetics.com>

diff --git a/services/arv-git-httpd/auth_handler_test.go b/services/arv-git-httpd/auth_handler_test.go
index 05fde03e7..a8fb3acd4 100644
--- a/services/arv-git-httpd/auth_handler_test.go
+++ b/services/arv-git-httpd/auth_handler_test.go
@@ -13,6 +13,7 @@ import (
 	"path/filepath"
 	"strings"
 
+	"git.curoverse.com/arvados.git/lib/config"
 	"git.curoverse.com/arvados.git/sdk/go/arvados"
 	"git.curoverse.com/arvados.git/sdk/go/arvadostest"
 	check "gopkg.in/check.v1"
@@ -34,16 +35,16 @@ func (s *AuthHandlerSuite) SetUpTest(c *check.C) {
 	arvadostest.ResetEnv()
 	repoRoot, err := filepath.Abs("../api/tmp/git/test")
 	c.Assert(err, check.IsNil)
-	theConfig = &Config{
-		Client: arvados.Client{
-			APIHost:  arvadostest.APIHost(),
-			Insecure: true,
-		},
-		Listen:          ":0",
-		GitCommand:      "/usr/bin/git",
-		RepoRoot:        repoRoot,
-		ManagementToken: arvadostest.ManagementToken,
-	}
+
+	cfg, err := config.NewLoader(nil, nil).Load()
+	c.Assert(err, check.Equals, nil)
+	cluster, err := cfg.GetCluster("")
+	c.Assert(err, check.Equals, nil)
+
+	cluster.Services.GitHTTP.InternalURLs = map[arvados.URL]arvados.ServiceInstance{arvados.URL{Host: "localhost:0"}: arvados.ServiceInstance{}}
+	cluster.TLS.Insecure = true
+	cluster.Git.GitCommand = "/usr/bin/git"
+	cluster.Git.Repositories = repoRoot
 }
 
 func (s *AuthHandlerSuite) TestPermission(c *check.C) {
diff --git a/services/arv-git-httpd/git_handler_test.go b/services/arv-git-httpd/git_handler_test.go
index 0cf7de4e2..8417b57e4 100644
--- a/services/arv-git-httpd/git_handler_test.go
+++ b/services/arv-git-httpd/git_handler_test.go
@@ -10,17 +10,27 @@ import (
 	"net/url"
 	"regexp"
 
+	"git.curoverse.com/arvados.git/lib/config"
+	"git.curoverse.com/arvados.git/sdk/go/arvados"
 	check "gopkg.in/check.v1"
 )
 
 var _ = check.Suite(&GitHandlerSuite{})
 
-type GitHandlerSuite struct{}
+type GitHandlerSuite struct {
+	cluster *arvados.Cluster
+}
 
 func (s *GitHandlerSuite) TestEnvVars(c *check.C) {
-	theConfig = defaultConfig()
-	theConfig.RepoRoot = "/"
-	theConfig.GitoliteHome = "/test/ghh"
+
+	cfg, err := config.NewLoader(nil, nil).Load()
+	c.Assert(err, check.Equals, nil)
+	s.cluster, err = cfg.GetCluster("")
+	c.Assert(err, check.Equals, nil)
+
+	s.cluster.Services.GitHTTP.InternalURLs = map[arvados.URL]arvados.ServiceInstance{arvados.URL{Host: "localhost:80"}: arvados.ServiceInstance{}}
+	s.cluster.Git.GitoliteHome = "/test/ghh"
+	s.cluster.Git.Repositories = "/"
 
 	u, err := url.Parse("git.zzzzz.arvadosapi.com/test")
 	c.Check(err, check.Equals, nil)
@@ -30,7 +40,7 @@ func (s *GitHandlerSuite) TestEnvVars(c *check.C) {
 		URL:        u,
 		RemoteAddr: "[::1]:12345",
 	}
-	h := newGitHandler()
+	h := newGitHandler(s.cluster)
 	h.(*gitHandler).Path = "/bin/sh"
 	h.(*gitHandler).Args = []string{"-c", "printf 'Content-Type: text/plain\r\n\r\n'; env"}
 
@@ -43,7 +53,7 @@ func (s *GitHandlerSuite) TestEnvVars(c *check.C) {
 	c.Check(body, check.Matches, `(?ms).*^GL_BYPASS_ACCESS_CHECKS=1$.*`)
 	c.Check(body, check.Matches, `(?ms).*^REMOTE_HOST=::1$.*`)
 	c.Check(body, check.Matches, `(?ms).*^REMOTE_PORT=12345$.*`)
-	c.Check(body, check.Matches, `(?ms).*^SERVER_ADDR=`+regexp.QuoteMeta(theConfig.Listen)+`$.*`)
+	c.Check(body, check.Matches, `(?ms).*^SERVER_ADDR=`+regexp.QuoteMeta("localhost:80")+`$.*`)
 }
 
 func (s *GitHandlerSuite) TestCGIErrorOnSplitHostPortError(c *check.C) {
@@ -55,7 +65,7 @@ func (s *GitHandlerSuite) TestCGIErrorOnSplitHostPortError(c *check.C) {
 		URL:        u,
 		RemoteAddr: "test.bad.address.missing.port",
 	}
-	h := newGitHandler()
+	h := newGitHandler(s.cluster)
 	h.ServeHTTP(resp, req)
 	c.Check(resp.Code, check.Equals, http.StatusInternalServerError)
 	c.Check(resp.Body.String(), check.Equals, "")
diff --git a/services/arv-git-httpd/gitolite_test.go b/services/arv-git-httpd/gitolite_test.go
index 88cd221cb..eaa7b55f8 100644
--- a/services/arv-git-httpd/gitolite_test.go
+++ b/services/arv-git-httpd/gitolite_test.go
@@ -10,8 +10,8 @@ import (
 	"os/exec"
 	"strings"
 
+	"git.curoverse.com/arvados.git/lib/config"
 	"git.curoverse.com/arvados.git/sdk/go/arvados"
-	"git.curoverse.com/arvados.git/sdk/go/arvadostest"
 	check "gopkg.in/check.v1"
 )
 
@@ -47,16 +47,18 @@ func (s *GitoliteSuite) SetUpTest(c *check.C) {
 	runGitolite("gitolite", "setup", "--admin", "root")
 
 	s.tmpRepoRoot = s.gitoliteHome + "/repositories"
-	s.Config = &Config{
-		Client: arvados.Client{
-			APIHost:  arvadostest.APIHost(),
-			Insecure: true,
-		},
-		Listen:       "localhost:0",
-		GitCommand:   "/usr/share/gitolite3/gitolite-shell",
-		GitoliteHome: s.gitoliteHome,
-		RepoRoot:     s.tmpRepoRoot,
-	}
+
+	cfg, err := config.NewLoader(nil, nil).Load()
+	c.Assert(err, check.Equals, nil)
+	s.cluster, err = cfg.GetCluster("")
+	c.Assert(err, check.Equals, nil)
+
+	s.cluster.Services.GitHTTP.InternalURLs = map[arvados.URL]arvados.ServiceInstance{arvados.URL{Host: "localhost:0"}: arvados.ServiceInstance{}}
+	s.cluster.TLS.Insecure = true
+	s.cluster.Git.GitCommand = "/usr/share/gitolite3/gitolite-shell"
+	s.cluster.Git.GitoliteHome = s.gitoliteHome
+	s.cluster.Git.Repositories = s.tmpRepoRoot
+
 	s.IntegrationSuite.SetUpTest(c)
 
 	// Install the gitolite hooks in the bare repo we made in
diff --git a/services/arv-git-httpd/integration_test.go b/services/arv-git-httpd/integration_test.go
index 53b636dc0..a6f114140 100644
--- a/services/arv-git-httpd/integration_test.go
+++ b/services/arv-git-httpd/integration_test.go
@@ -12,6 +12,7 @@ import (
 	"strings"
 	"testing"
 
+	"git.curoverse.com/arvados.git/lib/config"
 	"git.curoverse.com/arvados.git/sdk/go/arvados"
 	"git.curoverse.com/arvados.git/sdk/go/arvadostest"
 	check "gopkg.in/check.v1"
@@ -28,7 +29,7 @@ type IntegrationSuite struct {
 	tmpRepoRoot string
 	tmpWorkdir  string
 	testServer  *server
-	Config      *Config
+	cluster     *arvados.Cluster
 }
 
 func (s *IntegrationSuite) SetUpSuite(c *check.C) {
@@ -41,7 +42,7 @@ func (s *IntegrationSuite) TearDownSuite(c *check.C) {
 
 func (s *IntegrationSuite) SetUpTest(c *check.C) {
 	arvadostest.ResetEnv()
-	s.testServer = &server{}
+
 	var err error
 	if s.tmpRepoRoot == "" {
 		s.tmpRepoRoot, err = ioutil.TempDir("", "arv-git-httpd")
@@ -71,19 +72,6 @@ func (s *IntegrationSuite) SetUpTest(c *check.C) {
 		"none").Output()
 	c.Assert(err, check.Equals, nil)
 
-	if s.Config == nil {
-		s.Config = &Config{
-			Client: arvados.Client{
-				APIHost:  arvadostest.APIHost(),
-				Insecure: true,
-			},
-			Listen:          "localhost: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.
@@ -91,7 +79,24 @@ func (s *IntegrationSuite) SetUpTest(c *check.C) {
 	os.Unsetenv("ARVADOS_API_HOST_INSECURE")
 	os.Unsetenv("ARVADOS_API_TOKEN")
 
-	theConfig = s.Config
+	cfg, err := config.NewLoader(nil, nil).Load()
+	c.Assert(err, check.Equals, nil)
+	s.cluster, err = cfg.GetCluster("")
+	c.Assert(err, check.Equals, nil)
+
+	if s.cluster == nil {
+		s.cluster.Services.GitHTTP.InternalURLs = map[arvados.URL]arvados.ServiceInstance{arvados.URL{Host: "localhost:0"}: arvados.ServiceInstance{}}
+		s.cluster.TLS.Insecure = true
+		s.cluster.Git.GitCommand = "/usr/bin/git"
+		s.cluster.Git.Repositories = s.tmpRepoRoot
+	}
+
+	println(s.cluster.Services.Controller.InternalURLs)
+	println(arvadostest.APIHost())
+	println(s.cluster.ManagementToken)
+	println(arvadostest.ManagementToken)
+
+	s.testServer = &server{cluster: s.cluster}
 	err = s.testServer.Start()
 	c.Assert(err, check.Equals, nil)
 }
@@ -116,9 +121,7 @@ func (s *IntegrationSuite) TearDownTest(c *check.C) {
 	}
 	s.tmpWorkdir = ""
 
-	s.Config = nil
-
-	theConfig = defaultConfig()
+	s.cluster = nil
 }
 
 func (s *IntegrationSuite) RunGit(c *check.C, token, gitCmd, repo string, args ...string) error {

commit 68e1af73379e045d831583cf452b9ae863dc42cc
Author: Eric Biagiotti <ebiagiotti at veritasgenetics.com>
Date:   Mon Aug 26 10:43:55 2019 -0400

    14712: Cleans up arv-git arvbox setup
    
    Arvados-DCO-1.1-Signed-off-by: Eric Biagiotti <ebiagiotti at veritasgenetics.com>

diff --git a/tools/arvbox/lib/arvbox/docker/cluster-config.sh b/tools/arvbox/lib/arvbox/docker/cluster-config.sh
index 4f1a48d92..fa4f30f23 100755
--- a/tools/arvbox/lib/arvbox/docker/cluster-config.sh
+++ b/tools/arvbox/lib/arvbox/docker/cluster-config.sh
@@ -88,7 +88,7 @@ Clusters:
       GitHTTP:
         InternalURLs:
           "http://localhost:${services[arv-git-httpd]}/": {}
-        ExternalURL: "https://git.$localip:${services[arv-git-httpd-ssl]}/"
+        ExternalURL: "https://$localip:${services[arv-git-httpd-ssl]}/"
       WebDAV:
         InternalURLs:
           "http://localhost:${services[keep-web]}/": {}
diff --git a/tools/arvbox/lib/arvbox/docker/service/nginx/run b/tools/arvbox/lib/arvbox/docker/service/nginx/run
index 96c0cf049..0d60e7412 100755
--- a/tools/arvbox/lib/arvbox/docker/service/nginx/run
+++ b/tools/arvbox/lib/arvbox/docker/service/nginx/run
@@ -148,7 +148,7 @@ server {
   }
   server {
     listen *:${services[arv-git-httpd-ssl]} ssl default_server;
-    server_name git.${localip};
+    server_name arvados-git-httpd;
     proxy_connect_timeout 90s;
     proxy_read_timeout 300s;
 

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list