13431: Fixes unrelated test
authorLucas Di Pentima <ldipentima@veritasgenetics.com>
Tue, 5 Jun 2018 18:37:05 +0000 (15:37 -0300)
committerLucas Di Pentima <ldipentima@veritasgenetics.com>
Tue, 5 Jun 2018 18:37:05 +0000 (15:37 -0300)
Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <ldipentima@veritasgenetics.com>

services/keepproxy/keepproxy_test.go

index 9b58c394b58750c0c2944fe3a252f5fc1b113699..b5e30de4e44f55352285730896cbf8f901ea69cb 100644 (file)
@@ -617,30 +617,29 @@ func (s *ServerRequiredSuite) TestPutAskGetInvalidToken(c *C) {
 }
 
 func (s *ServerRequiredSuite) TestAskGetKeepProxyConnectionError(c *C) {
-       arv, err := arvadosclient.MakeArvadosClient()
-       c.Assert(err, Equals, nil)
+       kc := runProxy(c, nil, false)
+       defer closeListener()
 
-       // keepclient with no such keep server
-       kc := keepclient.New(arv)
+       // Point keepproxy to a non-existant keepstore
        locals := map[string]string{
                TestProxyUUID: "http://localhost:12345",
        }
-       kc.SetServiceRoots(locals, nil, nil)
+       router.(*proxyHandler).KeepClient.SetServiceRoots(locals, nil, nil)
 
-       // Ask should result in temporary connection refused error
+       // Ask should result in temporary bad gateway error
        hash := fmt.Sprintf("%x", md5.Sum([]byte("foo")))
-       _, _, err = kc.Ask(hash)
+       _, _, err := kc.Ask(hash)
        c.Check(err, NotNil)
        errNotFound, _ := err.(*keepclient.ErrNotFound)
        c.Check(errNotFound.Temporary(), Equals, true)
-       c.Assert(err, ErrorMatches, ".*connection refused.*")
+       c.Assert(err, ErrorMatches, ".*HTTP 502.*")
 
-       // Get should result in temporary connection refused error
+       // Get should result in temporary bad gateway error
        _, _, _, err = kc.Get(hash)
        c.Check(err, NotNil)
        errNotFound, _ = err.(*keepclient.ErrNotFound)
        c.Check(errNotFound.Temporary(), Equals, true)
-       c.Assert(err, ErrorMatches, ".*connection refused.*")
+       c.Assert(err, ErrorMatches, ".*HTTP 502.*")
 }
 
 func (s *NoKeepServerSuite) TestAskGetNoKeepServerError(c *C) {