From cc2bbde8f1edc14ec73f96dc0485367c41ac855a Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Fri, 28 Jul 2023 18:50:51 +0800 Subject: [PATCH] test: use BOOST_CHECK_EQUAL when appropriate in compaction_manager_basic_test compaction_manager_basic_test checks the stats of compaction_manager to verify that there are no ongoing or pending compactions after the triggering the compaction and waiting for its completion. but in #14865, there are still active compaction(s) after the compaction_manager's stats shows there is at least one task completed. to understand this issue better, let's use `BOOST_CHECK_EQUAL()` instead of `BOOST_REQUIRE()`, so that the test does not error out when the check fails, and we can have better understanding of the status when the test fails. Refs #14865 Signed-off-by: Kefu Chai Closes #14872 --- test/boost/sstable_compaction_test.cc | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/test/boost/sstable_compaction_test.cc b/test/boost/sstable_compaction_test.cc index 810bdb623d..c031f67e13 100644 --- a/test/boost/sstable_compaction_test.cc +++ b/test/boost/sstable_compaction_test.cc @@ -178,13 +178,14 @@ SEASTAR_TEST_CASE(compaction_manager_basic_test) { return sleep(std::chrono::milliseconds(100)); }).wait(); // test no more running compactions - BOOST_REQUIRE(cm.get_stats().pending_tasks == 0 && cm.get_stats().active_tasks == 0); + BOOST_CHECK_EQUAL(cm.get_stats().pending_tasks, 0); + BOOST_CHECK_EQUAL(cm.get_stats().active_tasks, 0); // test compaction successfully finished - BOOST_REQUIRE(cm.get_stats().completed_tasks == 1); - BOOST_REQUIRE(cm.get_stats().errors == 0); + BOOST_CHECK_EQUAL(cm.get_stats().completed_tasks, 1); + BOOST_CHECK_EQUAL(cm.get_stats().errors, 0); // expect sstables of cf to be compacted. - BOOST_REQUIRE(cf->sstables_count() == 1); + BOOST_CHECK_EQUAL(cf->sstables_count(), 1); }); }