From f3eb0b5b8c9d1c84f25bd930ec0374147b041be6 Mon Sep 17 00:00:00 2001 From: Islam AbdelRahman Date: Mon, 25 Apr 2016 18:18:35 -0700 Subject: [PATCH] Make EventListenerTest.CompactionReasonLevel more deterministic Summary: In this test some times automatic compactions do everything and Manual compaction become a no-op. Update the test to make sure manual compaction is not a no-op Test Plan: run the test Reviewers: andrewkr, yhchiang, sdong Reviewed By: sdong Subscribers: andrewkr, dhruba Differential Revision: https://reviews.facebook.net/D57189 --- db/listener_test.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/db/listener_test.cc b/db/listener_test.cc index fe5547705..26a5cf101 100644 --- a/db/listener_test.cc +++ b/db/listener_test.cc @@ -484,7 +484,10 @@ TEST_F(EventListenerTest, CompactionReasonLevel) { listener->compaction_reasons_.clear(); Reopen(options); - db_->CompactRange(CompactRangeOptions(), nullptr, nullptr); + Put("key", "value"); + CompactRangeOptions cro; + cro.bottommost_level_compaction = BottommostLevelCompaction::kForce; + ASSERT_OK(db_->CompactRange(cro, nullptr, nullptr)); ASSERT_GT(listener->compaction_reasons_.size(), 0); for (auto compaction_reason : listener->compaction_reasons_) { ASSERT_EQ(compaction_reason, CompactionReason::kManualCompaction);