From cbdd07a7eecf5f0d15ce9707b1f8592e0de8f22f Mon Sep 17 00:00:00 2001 From: Ronen Friedman Date: Thu, 21 Aug 2025 09:40:13 -0500 Subject: [PATCH] test/osd/scrub: fix test_scrubber_be following EC Scrub b.e. changes Signed-off-by: Ronen Friedman --- src/test/osd/test_scrubber_be.cc | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/src/test/osd/test_scrubber_be.cc b/src/test/osd/test_scrubber_be.cc index 60e995aed5f..4bab20dd889 100644 --- a/src/test/osd/test_scrubber_be.cc +++ b/src/test/osd/test_scrubber_be.cc @@ -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(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(*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 -- 2.39.5