]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/tests: add simple multi-replica test for backfill.
authorRadoslaw Zarzynski <rzarzyns@redhat.com>
Thu, 19 Nov 2020 16:01:45 +0000 (17:01 +0100)
committerRadoslaw Zarzynski <rzarzyns@redhat.com>
Tue, 1 Dec 2020 12:22:16 +0000 (13:22 +0100)
Signed-off-by: Radoslaw Zarzynski <rzarzyns@redhat.com>
src/test/crimson/test_backfill.cc

index 0409d47253d24682066e33d2f0ee6dc44d9bf7dc..6caa18fd9988c62a967b381b1a4db3e8f7ccb113 100644 (file)
@@ -355,7 +355,7 @@ TEST(backfill, same_primary_same_replica)
   EXPECT_TRUE(cluster_fixture.all_stores_look_like(reference_store));
 }
 
-TEST(backfill, single_empty_replica)
+TEST(backfill, one_empty_replica)
 {
   const auto reference_store = FakeStore{ {
     { "1:00058bcc:::rbd_data.1018ac3e755.00000000000000d5:head", {10, 234} },
@@ -376,6 +376,27 @@ TEST(backfill, single_empty_replica)
   EXPECT_TRUE(cluster_fixture.all_stores_look_like(reference_store));
 }
 
+TEST(backfill, two_empty_replicas)
+{
+  const auto reference_store = FakeStore{ {
+    { "1:00058bcc:::rbd_data.1018ac3e755.00000000000000d5:head", {10, 234} },
+    { "1:00ed7f8e:::rbd_data.1018ac3e755.00000000000000af:head", {10, 196} },
+    { "1:01483aea:::rbd_data.1018ac3e755.0000000000000095:head", {10, 169} },
+  }};
+  auto cluster_fixture = BackfillFixtureBuilder::add_source(
+    reference_store.objs
+  ).add_target(
+    { /* nothing 1 */ }
+  ).add_target(
+    { /* nothing 2 */ }
+  ).get_result();
+
+  EXPECT_CALL(cluster_fixture, backfilled);
+  cluster_fixture.next_till_done();
+
+  EXPECT_TRUE(cluster_fixture.all_stores_look_like(reference_store));
+}
+
 namespace StoreRandomizer {
   // FIXME: copied & pasted from test/test_snap_mapper.cc. We need to
   // find a way to avoid code duplication in test. A static library?