Skip to content

Commit cbdd07a

Browse files
committed
test/osd/scrub: fix test_scrubber_be following EC Scrub b.e. changes
Signed-off-by: Ronen Friedman <[email protected]>
1 parent 4c61079 commit cbdd07a

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

src/test/osd/test_scrubber_be.cc

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -413,6 +413,12 @@ class TestTScrubberBe : public ::testing::Test {
413413
* \returns the PG info
414414
*/
415415
pg_info_t setup_pg_in_map();
416+
417+
/**
418+
* EC requires that set_stripe_data() is called before the
419+
* ScrubBackend object is constructed
420+
*/
421+
virtual void ec_set_stripe_info() {}
416422
};
417423

418424

@@ -466,6 +472,9 @@ void TestTScrubberBe::SetUp()
466472
test_pg = std::make_unique<TestPg>(pool, info, i_am);
467473
std::cout << fmt::format("{}: acting: {}", __func__, acting_shards)
468474
<< std::endl;
475+
476+
// an EC-only hook to allocate & init the 'stripe conf' structure
477+
ec_set_stripe_info();
469478
sbe = std::make_unique<TestScrubBackend>(*test_scrubber,
470479
*test_pg,
471480
i_am,
@@ -772,7 +781,7 @@ class TestTScrubberBe_data_2 : public TestTScrubberBe {
772781
TestTScrubberBe_data_2() : TestTScrubberBe() {}
773782

774783
// basic test configuration - 3 OSDs, all involved in the pool
775-
pool_conf_t pl{3, 3, 3, 3, "rep_pool", pg_pool_t::TYPE_REPLICATED,
784+
pool_conf_t pl{3, 3, 3, 3, "rep_pool", pg_pool_t::TYPE_REPLICATED,
776785
std::nullopt};
777786

778787
TestTScrubberBeParams inject_params() override
@@ -853,6 +862,11 @@ class TestTScrubberBeECCorruptShards : public TestTScrubberBe {
853862

854863
return params;
855864
}
865+
866+
void ec_set_stripe_info() override
867+
{
868+
test_pg->set_stripe_info(k, m, k * m_chunk_size, &test_pg->m_pool->info);
869+
}
856870
};
857871

858872
class TestTScrubberBeECNoCorruptShards : public TestTScrubberBeECCorruptShards {
@@ -861,8 +875,6 @@ class TestTScrubberBeECNoCorruptShards : public TestTScrubberBeECCorruptShards {
861875
};
862876

863877
TEST_F(TestTScrubberBeECNoCorruptShards, ec_parity_inconsistency) {
864-
test_pg->set_stripe_info(k, m, k * m_chunk_size, &test_pg->m_pool->info);
865-
866878
ASSERT_TRUE(sbe); // Assert we have a scrubber backend
867879
logger.set_expected_err_count(
868880
0); // Set the number of errors we expect to see
@@ -891,8 +903,6 @@ class TestTScrubberBeECSingleCorruptDataShard
891903
};
892904

893905
TEST_F(TestTScrubberBeECSingleCorruptDataShard, ec_parity_inconsistency) {
894-
test_pg->set_stripe_info(k, m, k * m_chunk_size, &test_pg->m_pool->info);
895-
896906
ASSERT_TRUE(sbe); // Assert we have a scrubber backend
897907
logger.set_expected_err_count(
898908
1); // Set the number of errors we expect to see
@@ -920,8 +930,6 @@ class TestTScrubberBeECCorruptParityShard
920930
};
921931

922932
TEST_F(TestTScrubberBeECCorruptParityShard, ec_parity_inconsistency) {
923-
test_pg->set_stripe_info(k, m, k * m_chunk_size, &test_pg->m_pool->info);
924-
925933
ASSERT_TRUE(sbe); // Assert we have a scrubber backend
926934
logger.set_expected_err_count(
927935
1); // Set the number of errors we expect to see

0 commit comments

Comments
 (0)