projects
/
arvados.git
/ blobdiff
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
5824: Log actual client IP address (along with X-Forwarded-For header, if any).
[arvados.git]
/
services
/
arv-git-httpd
/
gitolite_test.go
diff --git
a/services/arv-git-httpd/gitolite_test.go
b/services/arv-git-httpd/gitolite_test.go
index 9596ecd96dd5531e52dc27da3b5819605ebe196e..aa710262b499b9c0a5e5168a8a69fc039ddeca36 100644
(file)
--- a/
services/arv-git-httpd/gitolite_test.go
+++ b/
services/arv-git-httpd/gitolite_test.go
@@
-13,7
+13,7
@@
var _ = check.Suite(&GitoliteSuite{})
// GitoliteSuite tests need an API server, an arv-git-httpd server,
// and a repository hosted by gitolite.
type GitoliteSuite struct {
// GitoliteSuite tests need an API server, an arv-git-httpd server,
// and a repository hosted by gitolite.
type GitoliteSuite struct {
-
serverSuite
IntegrationSuite
+ IntegrationSuite
gitoliteHome string
}
gitoliteHome string
}
@@
-34,16
+34,16
@@
func (s *GitoliteSuite) SetUpTest(c *check.C) {
runGitolite("gitolite", "setup", "--admin", "root")
runGitolite("gitolite", "setup", "--admin", "root")
- s.
serverSuite.
tmpRepoRoot = s.gitoliteHome + "/repositories"
- s.
serverSuite.
Config = &config{
+ s.tmpRepoRoot = s.gitoliteHome + "/repositories"
+ s.Config = &config{
Addr: ":0",
GitCommand: "/usr/share/gitolite3/gitolite-shell",
Addr: ":0",
GitCommand: "/usr/share/gitolite3/gitolite-shell",
- Root: s.
serverSuite.
tmpRepoRoot,
+ Root: s.tmpRepoRoot,
}
}
- s.
server
Suite.SetUpTest(c)
+ s.
Integration
Suite.SetUpTest(c)
// Install the gitolite hooks in the bare repo we made in
// Install the gitolite hooks in the bare repo we made in
- //
s.serverSuite.
SetUpTest() -- see 2.2.4 at
+ //
(*IntegrationTest)
SetUpTest() -- see 2.2.4 at
// http://gitolite.com/gitolite/gitolite.html
runGitolite("gitolite", "setup")
// http://gitolite.com/gitolite/gitolite.html
runGitolite("gitolite", "setup")
@@
-52,27
+52,31
@@
func (s *GitoliteSuite) SetUpTest(c *check.C) {
}
func (s *GitoliteSuite) TearDownTest(c *check.C) {
}
func (s *GitoliteSuite) TearDownTest(c *check.C) {
- s.serverSuite.TearDownTest(c)
+ // We really want Unsetenv here, but it's not worth forcing an
+ // upgrade to Go 1.4.
+ os.Setenv("GITOLITE_HTTP_HOME", "")
+ os.Setenv("GL_BYPASS_ACCESS_CHECKS", "")
+ s.IntegrationSuite.TearDownTest(c)
}
func (s *GitoliteSuite) TestFetch(c *check.C) {
}
func (s *GitoliteSuite) TestFetch(c *check.C) {
- err := s.
serverSuite.r
unGit(c, activeToken, "fetch", "active/foo.git")
+ err := s.
R
unGit(c, activeToken, "fetch", "active/foo.git")
c.Check(err, check.Equals, nil)
}
func (s *GitoliteSuite) TestFetchUnreadable(c *check.C) {
c.Check(err, check.Equals, nil)
}
func (s *GitoliteSuite) TestFetchUnreadable(c *check.C) {
- err := s.
serverSuite.r
unGit(c, anonymousToken, "fetch", "active/foo.git")
+ err := s.
R
unGit(c, anonymousToken, "fetch", "active/foo.git")
c.Check(err, check.ErrorMatches, `.* not found.*`)
}
func (s *GitoliteSuite) TestPush(c *check.C) {
c.Check(err, check.ErrorMatches, `.* not found.*`)
}
func (s *GitoliteSuite) TestPush(c *check.C) {
- err := s.
serverSuite.runGit(c, activeToken, "push", "active/foo.git
")
+ err := s.
RunGit(c, activeToken, "push", "active/foo.git", "master:gitolite-push
")
c.Check(err, check.Equals, nil)
// Check that the commit hash appears in the gitolite log, as
// assurance that the gitolite hooks really did run.
c.Check(err, check.Equals, nil)
// Check that the commit hash appears in the gitolite log, as
// assurance that the gitolite hooks really did run.
- sha1, err := exec.Command("git", "--git-dir", s.
serverSuite.
tmpWorkdir + "/.git",
+ sha1, err := exec.Command("git", "--git-dir", s.tmpWorkdir + "/.git",
"log", "-n1", "--format=%H").CombinedOutput()
c.Logf("git-log in workdir: %q", string(sha1))
c.Assert(err, check.Equals, nil)
"log", "-n1", "--format=%H").CombinedOutput()
c.Logf("git-log in workdir: %q", string(sha1))
c.Assert(err, check.Equals, nil)
@@
-84,6
+88,6
@@
func (s *GitoliteSuite) TestPush(c *check.C) {
}
func (s *GitoliteSuite) TestPushUnwritable(c *check.C) {
}
func (s *GitoliteSuite) TestPushUnwritable(c *check.C) {
- err := s.
serverSuite.runGit(c, spectatorToken, "push", "active/foo.git
")
+ err := s.
RunGit(c, spectatorToken, "push", "active/foo.git", "master:gitolite-push-fail
")
c.Check(err, check.ErrorMatches, `.*HTTP code = 403.*`)
}
c.Check(err, check.ErrorMatches, `.*HTTP code = 403.*`)
}