10998: Adds test to confirm that keepclient's block cache is set up.
authorLucas Di Pentima <ldipentima@veritasgenetics.com>
Tue, 13 Aug 2019 17:14:04 +0000 (14:14 -0300)
committerLucas Di Pentima <ldipentima@veritasgenetics.com>
Tue, 13 Aug 2019 17:14:04 +0000 (14:14 -0300)
Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <ldipentima@veritasgenetics.com>

services/keep-web/handler_test.go

index 1d264fc052772809534b0a2db174ca3e91fc3604..1090151e1ae3fd872da91e6badc3ff277008eba8 100644 (file)
@@ -21,6 +21,7 @@ import (
        "git.curoverse.com/arvados.git/sdk/go/arvados"
        "git.curoverse.com/arvados.git/sdk/go/arvadostest"
        "git.curoverse.com/arvados.git/sdk/go/auth"
+       "git.curoverse.com/arvados.git/sdk/go/keepclient"
        check "gopkg.in/check.v1"
 )
 
@@ -38,6 +39,24 @@ func (s *UnitSuite) SetUpTest(c *check.C) {
        s.Config = cfg
 }
 
+func (s *UnitSuite) TestKeepClientBlockCache(c *check.C) {
+       cfg := newConfig(s.Config)
+       cfg.cluster.Collections.WebDAVCache.MaxBlockEntries = 42
+       h := handler{Config: cfg}
+       c.Check(keepclient.DefaultBlockCache.MaxBlocks, check.Not(check.Equals), cfg.cluster.Collections.WebDAVCache.MaxBlockEntries)
+       u := mustParseURL("http://keep-web.example/c=" + arvadostest.FooCollection + "/t=" + arvadostest.ActiveToken + "/foo")
+       req := &http.Request{
+               Method:     "GET",
+               Host:       u.Host,
+               URL:        u,
+               RequestURI: u.RequestURI(),
+       }
+       resp := httptest.NewRecorder()
+       h.ServeHTTP(resp, req)
+       c.Check(resp.Code, check.Equals, http.StatusOK)
+       c.Check(keepclient.DefaultBlockCache.MaxBlocks, check.Equals, cfg.cluster.Collections.WebDAVCache.MaxBlockEntries)
+}
+
 func (s *UnitSuite) TestCORSPreflight(c *check.C) {
        h := handler{Config: newConfig(s.Config)}
        u := mustParseURL("http://keep-web.example/c=" + arvadostest.FooCollection + "/foo")