Skip to content

Commit be1cff2

Browse files
Jaesoo Leefacebook-github-bot
authored andcommitted
fix flaky test EvictToNvmExpired and ReadFromNvmExpired
Summary: The NvmCacheTest EvictToNvmExpired and ReadFromNvmExpired are relying on the TTL. However, the reaper is enabled by default, the test could fail if it races with the reaper whose default interval is the same as 5s https://fburl.com/testinfra/dyr5ovwn Reviewed By: therealgymmy Differential Revision: D49751136 fbshipit-source-id: bc388eabd68b144b40336744e4114d4e1bbdefb6
1 parent 623e519 commit be1cff2

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

cachelib/allocator/nvmcache/tests/NvmCacheTests.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,10 @@ TEST_F(NvmCacheTest, EvictToNvmGetCheckCtime) {
269269
}
270270

271271
TEST_F(NvmCacheTest, EvictToNvmExpired) {
272-
auto& nvm = this->cache();
272+
// Test with TTL, so the reaper should be disabled
273+
auto& config = this->getConfig();
274+
config.reaperInterval = std::chrono::milliseconds(0);
275+
auto& nvm = this->makeCache();
273276
auto pid = this->poolId();
274277

275278
const uint32_t ttl = 5; // 5 second ttl
@@ -294,7 +297,10 @@ TEST_F(NvmCacheTest, EvictToNvmExpired) {
294297
}
295298

296299
TEST_F(NvmCacheTest, ReadFromNvmExpired) {
297-
auto& nvm = this->cache();
300+
// Test with TTL, so the reaper should be disabled
301+
auto& config = this->getConfig();
302+
config.reaperInterval = std::chrono::milliseconds(0);
303+
auto& nvm = this->makeCache();
298304
auto pid = this->poolId();
299305

300306
const uint32_t ttl = 5; // 5 second ttl

0 commit comments

Comments
 (0)