[ARVADOS] updated: 46580c9d21578ec9f0638c9cb464703c7ede00b3

Git user git at public.curoverse.com
Tue Jun 6 15:21:54 EDT 2017


Summary of changes:
 services/keep-web/cache_test.go | 29 ++++++++++++++++++++++++-----
 1 file changed, 24 insertions(+), 5 deletions(-)

       via  46580c9d21578ec9f0638c9cb464703c7ede00b3 (commit)
      from  0940739d41d71154937354696634a2989a9db9fc (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit 46580c9d21578ec9f0638c9cb464703c7ede00b3
Author: Tom Clegg <tom at curoverse.com>
Date:   Tue Jun 6 15:21:28 2017 -0400

    11809: More cache tests.
    
    Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tom at curoverse.com>

diff --git a/services/keep-web/cache_test.go b/services/keep-web/cache_test.go
index ef3a760..9538543 100644
--- a/services/keep-web/cache_test.go
+++ b/services/keep-web/cache_test.go
@@ -41,9 +41,28 @@ func (s *UnitSuite) TestCache(c *check.C) {
 		c.Check(coll["portable_data_hash"], check.Equals, arvadostest.FooPdh)
 		c.Check(coll["manifest_text"].(string)[:2], check.Equals, ". ")
 	}
-	c.Check(cache.Stats().Requests, check.Equals, uint64(7))
-	c.Check(cache.Stats().CollectionHits, check.Equals, uint64(6))
-	c.Check(cache.Stats().PermissionHits, check.Equals, uint64(5))
-	c.Check(cache.Stats().PDHHits, check.Equals, uint64(4))
-	c.Check(cache.Stats().APICalls, check.Equals, uint64(2))
+	c.Check(cache.Stats().Requests, check.Equals, uint64(5+2))
+	c.Check(cache.Stats().CollectionHits, check.Equals, uint64(4+2))
+	c.Check(cache.Stats().PermissionHits, check.Equals, uint64(4+1))
+	c.Check(cache.Stats().PDHHits, check.Equals, uint64(4+0))
+	c.Check(cache.Stats().APICalls, check.Equals, uint64(1+1))
+
+	// Alternating between two collections N times should produce
+	// only 2 more API calls.
+	arv.ApiToken = arvadostest.AdminToken
+	for i := 0; i < 20; i++ {
+		var target string
+		if i%2 == 0 {
+			target = arvadostest.HelloWorldCollection
+		} else {
+			target = arvadostest.FooBarDirCollection
+		}
+		_, err := cache.Get(arv, target, false)
+		c.Check(err, check.Equals, nil)
+	}
+	c.Check(cache.Stats().Requests, check.Equals, uint64(5+2+20))
+	c.Check(cache.Stats().CollectionHits, check.Equals, uint64(4+2+18))
+	c.Check(cache.Stats().PermissionHits, check.Equals, uint64(4+1+18))
+	c.Check(cache.Stats().PDHHits, check.Equals, uint64(4+0+18))
+	c.Check(cache.Stats().APICalls, check.Equals, uint64(1+1+2))
 }

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list