From 5e2c796589ea805196672a6e24be7cc445e30bc9 Mon Sep 17 00:00:00 2001 From: Islam AbdelRahman Date: Fri, 29 Jul 2016 11:42:28 -0700 Subject: [PATCH] Make DBTest.CompressionStatsTest more deterministic Summary: DBTest.CompressionStatsTest on non_shm test where the storage device is slow DBTest.CompressionStatsTest assumes that a flush happens to check the number of compressed blocks. This is not always true if the Flush is slow, make the test more deterministic by forcing a flush before doing the check Test Plan: Run the test locally Reviewers: andrewkr, yiwu, lightmark, sdong Reviewed By: sdong Subscribers: andrewkr, dhruba Differential Revision: https://reviews.facebook.net/D61317 --- db/db_test.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/db/db_test.cc b/db/db_test.cc index ea7238181..5bcc6a213 100644 --- a/db/db_test.cc +++ b/db/db_test.cc @@ -4731,6 +4731,7 @@ TEST_F(DBTest, CompressionStatsTest) { // compressible string ASSERT_OK(Put(Key(i), RandomString(&rnd, 128) + std::string(128, 'a'))); } + ASSERT_OK(Flush()); ASSERT_GT(options.statistics->getTickerCount(NUMBER_BLOCK_COMPRESSED), 0); for (int i = 0; i < kNumKeysWritten; ++i) { @@ -4750,6 +4751,7 @@ TEST_F(DBTest, CompressionStatsTest) { // compressible string ASSERT_OK(Put(Key(i), RandomString(&rnd, 128) + std::string(128, 'a'))); } + ASSERT_OK(Flush()); ASSERT_EQ(options.statistics->getTickerCount(NUMBER_BLOCK_COMPRESSED) - currentCompressions, 0);