Commit 4af5e24
fix flaky unit tests in NvmCacheTest
Summary:
This change fixes flaky unit tests in NvmCacheTest.
For NvmCacheTest.IsNewCacheInstanceStat, previously, we were checking if nvm cache is new
(GlobalCacheStats.isNewNvmCache) by comparing cache instance creation time and the nvm cache's
creation time https://fburl.com/code/9x4fcl34. However, since we are resetting the nvm cache's
creation time to current time when marking truncate (https://fburl.com/code/xzsvozpj), this is
timing depenedt and thus could get wrong. This was causing NvmCacheTest.IsNewCacheInstanceStat
(https://fburl.com/code/2sr8eonn) to fail often (e.g., https://fburl.com/testinfra/9045ppjx)
For NvmCacheTest.testCreateItemAsIOBufChained, the creation time of chained item is reset when it is
created as iobuf, so the verification check against the creation time of the item is wrong.
Reviewed By: therealgymmy
Differential Revision: D49324117
fbshipit-source-id: 4b85c6902fb663724be8d6e9eebb75d78109768b1 parent a1a91c2 commit 4af5e24
File tree
2 files changed
+7
-3
lines changed- cachelib/allocator
- nvmcache/tests
2 files changed
+7
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3412 | 3412 | | |
3413 | 3413 | | |
3414 | 3414 | | |
| 3415 | + | |
3415 | 3416 | | |
3416 | | - | |
| 3417 | + | |
| 3418 | + | |
3417 | 3419 | | |
3418 | 3420 | | |
3419 | 3421 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2179 | 2179 | | |
2180 | 2180 | | |
2181 | 2181 | | |
2182 | | - | |
2183 | | - | |
| 2182 | + | |
| 2183 | + | |
| 2184 | + | |
| 2185 | + | |
2184 | 2186 | | |
2185 | 2187 | | |
2186 | 2188 | | |
| |||
0 commit comments