Skip to content

Commit

Permalink
fix flaky SlidingBloomReplayCacheTest.cpp
Browse files Browse the repository at this point in the history
SlidingBloomReplayCacheTest.cpp test was flaky,  looks like the expiry
can happen at exactly 1 second, moving to 1001 milliseconds fixed it.

Test Plan:

Run locally

```
 ./build/fbcode_builder/getdeps.py build --src-dir=. fizz
 ./build/fbcode_builder/getdeps.py test --src-dir=. fizz
```

before, fails with:
```
[==========] 5 tests from 1 test suite ran. (1115 ms total)
[  PASSED  ] 4 tests.
[  FAILED  ] 1 test, listed below:
[  FAILED  ] SlidingBloomReplayCacheTest.TestTimeBucketing

 1 FAILED TEST
```

after, passes with:
```
100% tests passed, 0 tests failed out of 68

Total Test time (real) =   1.07 sec

```
  • Loading branch information
ahornby committed Jul 25, 2023
1 parent 45567ee commit 86197b1
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions fizz/server/test/SlidingBloomReplayCacheTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ TEST(SlidingBloomReplayCacheTest, TestTimeBucketing) {
}
});

// 0.5 seconds in, all values should still be set
// all values should still be set
folly::via(evb, [&]() {
evb->schedule(
[&]() {
Expand All @@ -133,7 +133,7 @@ TEST(SlidingBloomReplayCacheTest, TestTimeBucketing) {
std::chrono::milliseconds(500));
});

// 1.5 seconds in, all should be gone.
// all should be gone.
folly::via(evb, [&]() {
evb->schedule(
[&]() {
Expand All @@ -142,7 +142,7 @@ TEST(SlidingBloomReplayCacheTest, TestTimeBucketing) {
}
baton.post();
},
std::chrono::seconds(1));
std::chrono::milliseconds(1001));
});
baton.wait();
}
Expand Down

0 comments on commit 86197b1

Please sign in to comment.