X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/1765cd327b15151c113890860dd8818c6fc44962..f560e8aeb2a61cd4941f84e4fe119d27eefe6d8f:/services/arv-git-httpd/server_test.go diff --git a/services/arv-git-httpd/server_test.go b/services/arv-git-httpd/server_test.go index d773dd9e02..e5ddc29dec 100644 --- a/services/arv-git-httpd/server_test.go +++ b/services/arv-git-httpd/server_test.go @@ -91,6 +91,17 @@ func (s *IntegrationSuite) SetUpTest(c *check.C) { _, err = exec.Command("sh", "-c", "cd "+s.tmpWorkdir+" && echo work >work && git add work && git -c user.name=Foo -c user.email=Foo commit -am 'workdir: test'").CombinedOutput() c.Assert(err, check.Equals, nil) + _, err = exec.Command("git", "config", + "--file", s.tmpWorkdir+"/.git/config", + "credential.http://"+s.testServer.Addr+"/.helper", + "!cred(){ cat >/dev/null; if [ \"$1\" = get ]; then echo password=$ARVADOS_API_TOKEN; fi; };cred").Output() + c.Assert(err, check.Equals, nil) + _, err = exec.Command("git", "config", + "--file", s.tmpWorkdir+"/.git/config", + "credential.http://"+s.testServer.Addr+"/.username", + "none").Output() + c.Assert(err, check.Equals, nil) + theConfig = &config{ Addr: ":", GitCommand: "/usr/bin/git", @@ -127,9 +138,10 @@ func (s *IntegrationSuite) runGit(c *check.C, token, gitCmd, repo string, args . os.Chdir(s.tmpWorkdir) gitargs := append([]string{ - gitCmd, "http://none:" + token + "@" + s.testServer.Addr + "/" + repo, + gitCmd, "http://" + s.testServer.Addr + "/" + repo, }, args...) cmd := exec.Command("git", gitargs...) + cmd.Env = append(os.Environ(), "ARVADOS_API_TOKEN="+token) w, err := cmd.StdinPipe() c.Assert(err, check.Equals, nil) w.Close() @@ -148,9 +160,11 @@ func (s *IntegrationSuite) runGit(c *check.C, token, gitCmd, repo string, args . // Make a bare arvados repo at {tmpRepoRoot}/arvados.git func (s *IntegrationSuite) makeArvadosRepo(c *check.C) { - _, err := exec.Command("git", "init", "--bare", s.tmpRepoRoot+"/zzzzz-s0uqq-arvadosrepo0123.git").Output() + msg, err := exec.Command("git", "init", "--bare", s.tmpRepoRoot+"/zzzzz-s0uqq-arvadosrepo0123.git").CombinedOutput() + c.Log(string(msg)) c.Assert(err, check.Equals, nil) - _, err = exec.Command("git", "--git-dir", s.tmpRepoRoot+"/zzzzz-s0uqq-arvadosrepo0123.git", "fetch", "../../.git", "master:master").Output() + msg, err = exec.Command("git", "--git-dir", s.tmpRepoRoot+"/zzzzz-s0uqq-arvadosrepo0123.git", "fetch", "../../.git", "HEAD:master").CombinedOutput() + c.Log(string(msg)) c.Assert(err, check.Equals, nil) }