s.makeArvadosRepo(c)
// Spectator token
os.Setenv("ARVADOS_API_TOKEN", "zw2f4gwx8hw8cjre7yp6v1zylhrhn3m5gvjq73rtpwhmknrybu")
- for _, repo := range []string{"foo.git", "foo/.git", "arvados.git", "arvados/.git"} {
+ for _, repo := range []string{"active/foo.git", "active/foo/.git", "arvados.git", "arvados/.git"} {
err := s.runGit(c, "fetch", repo)
c.Assert(err, check.Equals, nil)
}
func (s *IntegrationSuite) TestReadonly(c *check.C) {
// Spectator token
os.Setenv("ARVADOS_API_TOKEN", "zw2f4gwx8hw8cjre7yp6v1zylhrhn3m5gvjq73rtpwhmknrybu")
- err := s.runGit(c, "fetch", "foo.git")
+ err := s.runGit(c, "fetch", "active/foo.git")
c.Assert(err, check.Equals, nil)
- err = s.runGit(c, "push", "foo.git", "master:newbranchfail")
+ err = s.runGit(c, "push", "active/foo.git", "master:newbranchfail")
c.Assert(err, check.ErrorMatches, `.*HTTP code = 403.*`)
- _, err = os.Stat(s.tmpRepoRoot + "/.git/refs/heads/newbranchfail")
+ _, err = os.Stat(s.tmpRepoRoot + "/zzzzz-s0uqq-382brsig8rp3666/.git/refs/heads/newbranchfail")
c.Assert(err, check.FitsTypeOf, &os.PathError{})
}
func (s *IntegrationSuite) TestReadwrite(c *check.C) {
// Active user token
os.Setenv("ARVADOS_API_TOKEN", "3kg6k6lzmp9kj5cpkcoxie963cmvjahbt2fod9zru30k1jqdmi")
- err := s.runGit(c, "fetch", "foo.git")
+ err := s.runGit(c, "fetch", "active/foo.git")
c.Assert(err, check.Equals, nil)
- err = s.runGit(c, "push", "foo.git", "master:newbranch")
+ err = s.runGit(c, "push", "active/foo.git", "master:newbranch")
c.Assert(err, check.Equals, nil)
- _, err = os.Stat(s.tmpRepoRoot + "/foo/.git/refs/heads/newbranch")
+ _, err = os.Stat(s.tmpRepoRoot + "/zzzzz-s0uqq-382brsig8rp3666/.git/refs/heads/newbranch")
c.Assert(err, check.Equals, nil)
}
c.Assert(err, check.ErrorMatches, `.* not found.*`)
}
+func (s *IntegrationSuite) TestMissingGitdirReadableRepository(c *check.C) {
+ // Active user token
+ os.Setenv("ARVADOS_API_TOKEN", "3kg6k6lzmp9kj5cpkcoxie963cmvjahbt2fod9zru30k1jqdmi")
+ err := s.runGit(c, "fetch", "active/foo2.git")
+ c.Assert(err, check.ErrorMatches, `.* not found.*`)
+}
+
func (s *IntegrationSuite) TestNoPermission(c *check.C) {
// Anonymous token
os.Setenv("ARVADOS_API_TOKEN", "4kg6k6lzmp9kj4cpkcoxie964cmvjahbt4fod9zru44k4jqdmi")
- for _, repo := range []string{"foo.git", "foo/.git"} {
+ for _, repo := range []string{"active/foo.git", "active/foo/.git"} {
err := s.runGit(c, "fetch", repo)
c.Assert(err, check.ErrorMatches, `.* not found.*`)
}
c.Assert(err, check.Equals, nil)
s.tmpWorkdir, err = ioutil.TempDir("", "arv-git-httpd")
c.Assert(err, check.Equals, nil)
- _, err = exec.Command("git", "init", s.tmpRepoRoot+"/foo").Output()
+ _, err = exec.Command("git", "init", s.tmpRepoRoot+"/zzzzz-s0uqq-382brsig8rp3666").Output()
c.Assert(err, check.Equals, nil)
- _, err = exec.Command("sh", "-c", "cd "+s.tmpRepoRoot+"/foo && echo test >test && git add test && git commit -am 'foo: test'").CombinedOutput()
+ _, err = exec.Command("sh", "-c", "cd "+s.tmpRepoRoot+"/zzzzz-s0uqq-382brsig8rp3666 && echo test >test && git add test && git -c user.name=Foo -c user.email=Foo commit -am 'foo: test'").CombinedOutput()
c.Assert(err, check.Equals, nil)
_, err = exec.Command("git", "init", s.tmpWorkdir).Output()
c.Assert(err, check.Equals, nil)
- _, err = exec.Command("sh", "-c", "cd "+s.tmpWorkdir+" && echo work >work && git add work && git commit -am 'workdir: test'").CombinedOutput()
+ _, 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)
theConfig = &config{
_, err = exec.Command("git", "config",
"--file", s.tmpWorkdir+"/.git/config",
"credential.http://"+s.testServer.Addr+"/.helper",
- "!foo(){ echo password=$ARVADOS_API_TOKEN; };foo").Output()
+ "!cred(){ echo password=$ARVADOS_API_TOKEN; };cred").Output()
c.Assert(err, check.Equals, nil)
_, err = exec.Command("git", "config",
"--file", s.tmpWorkdir+"/.git/config",
cmd := exec.Command("git", gitargs...)
w, err := cmd.StdinPipe()
c.Assert(err, check.Equals, nil)
- go w.Close()
+ w.Close()
output, err := cmd.CombinedOutput()
c.Log("git ", gitargs, " => ", err)
+ c.Log(string(output))
if err != nil && len(output) > 0 {
// If messages appeared on stderr, they are more
// helpful than the err returned by CombinedOutput().
// Make a bare arvados repo at {tmpRepoRoot}/arvados.git
func (s *IntegrationSuite) makeArvadosRepo(c *check.C) {
- _, err := exec.Command("git", "init", "--bare", s.tmpRepoRoot+"/arvados.git").Output()
+ _, err := exec.Command("git", "init", "--bare", s.tmpRepoRoot+"/zzzzz-s0uqq-arvadosrepo0123.git").Output()
c.Assert(err, check.Equals, nil)
- _, err = exec.Command("git", "--git-dir", s.tmpRepoRoot+"/arvados.git", "fetch", "../../.git", "master:master").Output()
+ _, err = exec.Command("git", "--git-dir", s.tmpRepoRoot+"/zzzzz-s0uqq-arvadosrepo0123.git", "fetch", "../../.git", "master:master").Output()
c.Assert(err, check.Equals, nil)
}