21636: Test http status returned for unknown backend errors.
authorTom Clegg <tom@curii.com>
Mon, 1 Apr 2024 13:20:02 +0000 (09:20 -0400)
committerTom Clegg <tom@curii.com>
Mon, 1 Apr 2024 13:20:02 +0000 (09:20 -0400)
Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tom@curii.com>

services/keepstore/router_test.go

index ee7be4768c91499e667c8ba50aa512c7b3a930a3..15a055d55ef3bddf23224cb70c8fac86a0b7777f 100644 (file)
@@ -373,6 +373,13 @@ func (s *routerSuite) TestVolumeErrorStatusCode(c *C) {
        c.Check(resp.Code, Equals, http.StatusBadGateway)
        c.Check(resp.Body.String(), Equals, "test error\n")
 
+       router.keepstore.mountsW[0].volume.(*stubVolume).blockRead = func(_ context.Context, hash string, w io.WriterAt) error {
+               return errors.New("no http status provided")
+       }
+       resp = call(router, "GET", "http://example/"+locSigned, arvadostest.ActiveTokenV2, nil, nil)
+       c.Check(resp.Code, Equals, http.StatusInternalServerError)
+       c.Check(resp.Body.String(), Equals, "no http status provided\n")
+
        c.Assert(router.keepstore.mountsW[1].volume.BlockWrite(context.Background(), barHash, []byte("bar")), IsNil)
 
        // If the requested block is available on the second volume,