projects
/
arvados.git
/ commitdiff
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
b93018f
)
5416: Add path variants test. Skip cloning arvados repo when not needed.
author
Tom Clegg <tom@curoverse.com>
Mon, 16 Mar 2015 21:37:45 +0000
(17:37 -0400)
committer
Tom Clegg <tom@curoverse.com>
Tue, 17 Mar 2015 14:57:28 +0000
(10:57 -0400)
services/arv-git-httpd/server_test.go
patch
|
blob
|
history
diff --git
a/services/arv-git-httpd/server_test.go
b/services/arv-git-httpd/server_test.go
index c3eed3d157d1d31b5ccb403b1b628e12d44033e8..9d2c190d7ac9f04716c61d37d658b2c8cb3f7ab7 100644
(file)
--- a/
services/arv-git-httpd/server_test.go
+++ b/
services/arv-git-httpd/server_test.go
@@
-21,6
+21,16
@@
type IntegrationSuite struct {
testServer *server
}
testServer *server
}
+func (s *IntegrationSuite) TestPathVariants(c *check.C) {
+ s.makeArvadosRepo(c)
+ // Spectator token
+ os.Setenv("ARVADOS_API_TOKEN", "zw2f4gwx8hw8cjre7yp6v1zylhrhn3m5gvjq73rtpwhmknrybu")
+ for _, repo := range []string{"foo.git", "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")
func (s *IntegrationSuite) TestReadonly(c *check.C) {
// Spectator token
os.Setenv("ARVADOS_API_TOKEN", "zw2f4gwx8hw8cjre7yp6v1zylhrhn3m5gvjq73rtpwhmknrybu")
@@
-53,7
+63,7
@@
func (s *IntegrationSuite) TestNonexistent(c *check.C) {
func (s *IntegrationSuite) TestNoPermission(c *check.C) {
// Anonymous token
os.Setenv("ARVADOS_API_TOKEN", "4kg6k6lzmp9kj4cpkcoxie964cmvjahbt4fod9zru44k4jqdmi")
func (s *IntegrationSuite) TestNoPermission(c *check.C) {
// Anonymous token
os.Setenv("ARVADOS_API_TOKEN", "4kg6k6lzmp9kj4cpkcoxie964cmvjahbt4fod9zru44k4jqdmi")
- for _, repo := range []string{"foo.git", "foo/.git"
, "foo/bar.git", "foo/bar/.git"
} {
+ for _, repo := range []string{"foo.git", "foo/.git"} {
err := s.runGit(c, "fetch", repo)
c.Assert(err, check.ErrorMatches, `.* not found:.*`)
}
err := s.runGit(c, "fetch", repo)
c.Assert(err, check.ErrorMatches, `.* not found:.*`)
}
@@
-71,10
+81,6
@@
func (s *IntegrationSuite) SetUpTest(c *check.C) {
c.Assert(err, check.Equals, nil)
s.tmpWorkdir, err = ioutil.TempDir("", "arv-git-httpd")
c.Assert(err, check.Equals, nil)
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", "--bare", s.tmpRepoRoot + "/arvados.git").Output()
- c.Assert(err, check.Equals, nil)
- _, err = exec.Command("git", "--git-dir", s.tmpRepoRoot + "/arvados.git", "fetch", "../../.git", "master:master").Output()
- c.Assert(err, check.Equals, nil)
_, err = exec.Command("git", "init", s.tmpRepoRoot + "/foo").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("git", "init", s.tmpRepoRoot + "/foo").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()
@@
-146,6
+152,14
@@
func (s *IntegrationSuite) runGit(c *check.C, gitCmd, repo string, args ...strin
return err
}
return err
}
+// 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()
+ c.Assert(err, check.Equals, nil)
+ _, err = exec.Command("git", "--git-dir", s.tmpRepoRoot + "/arvados.git", "fetch", "../../.git", "master:master").Output()
+ c.Assert(err, check.Equals, nil)
+}
+
// Gocheck boilerplate
func Test(t *testing.T) {
check.TestingT(t)
// Gocheck boilerplate
func Test(t *testing.T) {
check.TestingT(t)