5416: Merge branch 'master' into 5416-arv-git-httpd
[arvados.git] / services / arv-git-httpd / server_test.go
index 3971d17f9c181819907de8f738da3958581dd721..751e7e41c484fb659b6d875b75bb62124b4372e4 100644 (file)
@@ -57,7 +57,7 @@ func (s *IntegrationSuite) TestNonexistent(c *check.C) {
        // Spectator token
        os.Setenv("ARVADOS_API_TOKEN", "zw2f4gwx8hw8cjre7yp6v1zylhrhn3m5gvjq73rtpwhmknrybu")
        err := s.runGit(c, "fetch", "thisrepodoesnotexist.git")
-       c.Assert(err, check.ErrorMatches, `.* not found:.*`)
+       c.Assert(err, check.ErrorMatches, `.* not found.*`)
 }
 
 func (s *IntegrationSuite) TestNoPermission(c *check.C) {
@@ -65,7 +65,7 @@ func (s *IntegrationSuite) TestNoPermission(c *check.C) {
        os.Setenv("ARVADOS_API_TOKEN", "4kg6k6lzmp9kj4cpkcoxie964cmvjahbt4fod9zru44k4jqdmi")
        for _, repo := range []string{"foo.git", "foo/.git"} {
                err := s.runGit(c, "fetch", repo)
-               c.Assert(err, check.ErrorMatches, `.* not found:.*`)
+               c.Assert(err, check.ErrorMatches, `.* not found.*`)
        }
 }
 
@@ -145,8 +145,11 @@ func (s *IntegrationSuite) runGit(c *check.C, gitCmd, repo string, args ...strin
        go w.Close()
        output, err := cmd.CombinedOutput()
        c.Log("git ", gitargs, " => ", err)
-       if err != nil {
-               // Easier to match error strings without newlines.
+       if err != nil && len(output) > 0 {
+               // If messages appeared on stderr, they are more
+               // helpful than the err returned by CombinedOutput().
+               //
+               // Easier to match error strings without newlines:
                err = errors.New(strings.Replace(string(output), "\n", " // ", -1))
        }
        return err