fix flaky sim_cache_test

Summary: fix flaky test

Test Plan: `make all check`

Reviewers: sdong, andrewkr

Reviewed By: andrewkr

Subscribers: andrewkr, dhruba, leveldb

Differential Revision: https://reviews.facebook.net/D59157
main
Aaron Gao 9 years ago
parent 62d5480984
commit 630b732cb3
  1. 5
      utilities/simulator_cache/sim_cache_test.cc

@ -19,7 +19,7 @@ class SimCacheTest : public DBTestBase {
public: public:
const size_t kNumBlocks = 5; const size_t kNumBlocks = 5;
const size_t kValueSize = 100; const size_t kValueSize = 1000;
SimCacheTest() : DBTestBase("/sim_cache_test") {} SimCacheTest() : DBTestBase("/sim_cache_test") {}
@ -78,7 +78,7 @@ TEST_F(SimCacheTest, SimCache) {
auto options = GetOptions(table_options); auto options = GetOptions(table_options);
InitTable(options); InitTable(options);
std::shared_ptr<SimCache> simCache = std::shared_ptr<SimCache> simCache =
NewSimCache(NewLRUCache(0, 0, false), 10000, 0); NewSimCache(NewLRUCache(0, 0, false), 20000, 0);
table_options.block_cache = simCache; table_options.block_cache = simCache;
options.table_factory.reset(new BlockBasedTableFactory(table_options)); options.table_factory.reset(new BlockBasedTableFactory(table_options));
Reopen(options); Reopen(options);
@ -101,7 +101,6 @@ TEST_F(SimCacheTest, SimCache) {
ASSERT_LT(0, usage); ASSERT_LT(0, usage);
ASSERT_EQ(usage, simCache->GetSimUsage()); ASSERT_EQ(usage, simCache->GetSimUsage());
simCache->SetCapacity(usage); simCache->SetCapacity(usage);
simCache->SetSimCapacity(usage * 2);
ASSERT_EQ(usage, simCache->GetPinnedUsage()); ASSERT_EQ(usage, simCache->GetPinnedUsage());
// Test with strict capacity limit. // Test with strict capacity limit.

Loading…
Cancel
Save