]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
test/rgw: add DistinctGen to test_rgw_bucket_sync_cache
authorCasey Bodley <cbodley@redhat.com>
Mon, 16 May 2022 21:11:13 +0000 (17:11 -0400)
committerCasey Bodley <cbodley@redhat.com>
Fri, 27 May 2022 19:47:34 +0000 (15:47 -0400)
Signed-off-by: Casey Bodley <cbodley@redhat.com>
src/test/rgw/test_rgw_bucket_sync_cache.cc

index c5df5718d5961c4db3efbbc97655fc252e180aca..7809817fe50bc7b8b507fee9c5351392b072b55f 100644 (file)
@@ -61,6 +61,16 @@ TEST(BucketSyncCache, DistinctShards)
   EXPECT_EQ(0, cache->get(key2, std::nullopt)->counter);
 }
 
+TEST(BucketSyncCache, DistinctGen)
+{
+  auto cache = Cache::create(2);
+  const auto key = make_key("", "bucket", 0);
+  std::optional<uint64_t> gen1; // empty
+  std::optional<uint64_t> gen2 = 5;
+  cache->get(key, gen1)->counter = 1;
+  EXPECT_EQ(0, cache->get(key, gen2)->counter);
+}
+
 TEST(BucketSyncCache, DontEvictPinned)
 {
   auto cache = Cache::create(0);