Fixed DBCompactionTest.SkipStatsUpdateTest

Summary:
DBCompactionTest.SkipStatsUpdateTest relies on the number
of files opened during the DB::Open process, but the persisting
options file support altered this number and thus makes
DBCompactionTest.SkipStatsUpdateTest in certain environment.

This patch fixed this test failure.

Test Plan: db_compaction_test

Reviewers: igor, sdong, anthony, IslamAbdelRahman

Subscribers: dhruba, leveldb

Differential Revision: https://reviews.facebook.net/D50637
This commit is contained in:
Yueh-Hsuan Chiang 2015-11-12 07:43:28 -08:00
parent e11f676e34
commit 56245ddcf5

View File

@ -239,9 +239,12 @@ TEST_F(DBCompactionTest, SkipStatsUpdateTest) {
env_->random_file_open_counter_.store(0);
Reopen(options);
// As stats-update is disabled, we expect a very low
// number of random file open.
ASSERT_LT(env_->random_file_open_counter_.load(), 5);
// As stats-update is disabled, we expect a very low number of
// random file open.
// Note that this number must be changed accordingly if we change
// the number of files needed to be opened in the DB::Open process.
const int kMaxFileOpenCount = 10;
ASSERT_LT(env_->random_file_open_counter_.load(), kMaxFileOpenCount);
// Repeat the reopen process, but this time we enable
// stats-update.
@ -251,7 +254,7 @@ TEST_F(DBCompactionTest, SkipStatsUpdateTest) {
// Since we do a normal stats update on db-open, there
// will be more random open files.
ASSERT_GT(env_->random_file_open_counter_.load(), 5);
ASSERT_GT(env_->random_file_open_counter_.load(), kMaxFileOpenCount);
}
TEST_F(DBCompactionTest, TestTableReaderForCompaction) {