]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
test/osd/scrub: fix test_scrubber_be following EC Scrub b.e. changes wip-rf-eccalc
authorRonen Friedman <rfriedma@redhat.com>
Thu, 21 Aug 2025 14:40:13 +0000 (09:40 -0500)
committerRonen Friedman <rfriedma@redhat.com>
Thu, 21 Aug 2025 18:16:52 +0000 (13:16 -0500)
Signed-off-by: Ronen Friedman <rfriedma@redhat.com>
src/test/osd/test_scrubber_be.cc

index 60e995aed5f6c023d032238869bd396fc998bcc3..4bab20dd889e8a225da79c87734e78d323c5920a 100644 (file)
@@ -413,6 +413,12 @@ class TestTScrubberBe : public ::testing::Test {
    * \returns the PG info
    */
   pg_info_t setup_pg_in_map();
+
+  /**
+   * EC requires that set_stripe_data() is called before the
+   * ScrubBackend object is constructed
+   */
+  virtual void ec_set_stripe_info() {}
 };
 
 
@@ -466,6 +472,9 @@ void TestTScrubberBe::SetUp()
   test_pg = std::make_unique<TestPg>(pool, info, i_am);
   std::cout << fmt::format("{}: acting: {}", __func__, acting_shards)
            << std::endl;
+
+  // an EC-only hook to allocate & init the 'stripe conf' structure
+  ec_set_stripe_info();
   sbe = std::make_unique<TestScrubBackend>(*test_scrubber,
                                           *test_pg,
                                           i_am,
@@ -772,7 +781,7 @@ class TestTScrubberBe_data_2 : public TestTScrubberBe {
   TestTScrubberBe_data_2() : TestTScrubberBe() {}
 
   // basic test configuration - 3 OSDs, all involved in the pool
-  pool_conf_t pl{3,           3, 3, 3, "rep_pool", pg_pool_t::TYPE_REPLICATED,
+  pool_conf_t pl{3, 3, 3, 3, "rep_pool", pg_pool_t::TYPE_REPLICATED,
                  std::nullopt};
 
   TestTScrubberBeParams inject_params() override
@@ -853,6 +862,11 @@ class TestTScrubberBeECCorruptShards : public TestTScrubberBe {
 
     return params;
   }
+
+  void ec_set_stripe_info() override
+  {
+    test_pg->set_stripe_info(k, m, k * m_chunk_size, &test_pg->m_pool->info);
+  }
 };
 
 class TestTScrubberBeECNoCorruptShards : public TestTScrubberBeECCorruptShards {
@@ -861,8 +875,6 @@ class TestTScrubberBeECNoCorruptShards : public TestTScrubberBeECCorruptShards {
 };
 
 TEST_F(TestTScrubberBeECNoCorruptShards, ec_parity_inconsistency) {
-  test_pg->set_stripe_info(k, m, k * m_chunk_size, &test_pg->m_pool->info);
-
   ASSERT_TRUE(sbe);  // Assert we have a scrubber backend
   logger.set_expected_err_count(
       0);  // Set the number of errors we expect to see
@@ -891,8 +903,6 @@ class TestTScrubberBeECSingleCorruptDataShard
 };
 
 TEST_F(TestTScrubberBeECSingleCorruptDataShard, ec_parity_inconsistency) {
-  test_pg->set_stripe_info(k, m, k * m_chunk_size, &test_pg->m_pool->info);
-
   ASSERT_TRUE(sbe);  // Assert we have a scrubber backend
   logger.set_expected_err_count(
       1);  // Set the number of errors we expect to see
@@ -920,8 +930,6 @@ class TestTScrubberBeECCorruptParityShard
 };
 
 TEST_F(TestTScrubberBeECCorruptParityShard, ec_parity_inconsistency) {
-  test_pg->set_stripe_info(k, m, k * m_chunk_size, &test_pg->m_pool->info);
-
   ASSERT_TRUE(sbe);  // Assert we have a scrubber backend
   logger.set_expected_err_count(
       1);  // Set the number of errors we expect to see