+
+ coll2, err := cache.Get(arv, arvadostest.FooCollectionPDH, false)
+ c.Check(err, check.Equals, nil)
+ c.Assert(coll2, check.NotNil)
+ c.Check(coll2.PortableDataHash, check.Equals, arvadostest.FooCollectionPDH)
+ c.Check(coll2.ManifestText[:2], check.Equals, ". ")
+ c.Check(coll2.ManifestText, check.Not(check.Equals), coll.ManifestText)
+
+ s.checkCacheMetrics(c, cache.registry,
+ "requests 6",
+ "hits 4",
+ "permission_hits 4",
+ "pdh_hits 4",
+ "api_calls 2")
+
+ coll2, err = cache.Get(arv, arvadostest.FooCollectionPDH, false)
+ c.Check(err, check.Equals, nil)
+ c.Assert(coll2, check.NotNil)
+ c.Check(coll2.PortableDataHash, check.Equals, arvadostest.FooCollectionPDH)
+ c.Check(coll2.ManifestText[:2], check.Equals, ". ")
+
+ s.checkCacheMetrics(c, cache.registry,
+ "requests 7",
+ "hits 5",
+ "permission_hits 5",
+ "pdh_hits 4",
+ "api_calls 2")
+
+ // 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)