fix flaky TimeKeeper unit-test
authorTianjiao Yin <ytj@fb.com>
Thu, 22 Sep 2016 08:06:15 +0000 (01:06 -0700)
committerFacebook Github Bot 0 <facebook-github-bot-0-bot@fb.com>
Thu, 22 Sep 2016 08:08:55 +0000 (01:08 -0700)
Summary:
Sometime we have such unit-test failure

```
folly/futures/test/TimekeeperTest.cpp:134: Failure
Value of: flag
  Actual: false
Expected: true
```

This diff should make it less flaky, though I am not sure what's the best way to fix this flaky unit-test.

Reviewed By: yfeldblum

Differential Revision: D3889630

fbshipit-source-id: e7486d75fbcb3081d06724d213d4a2cf8942955d

folly/futures/test/TimekeeperTest.cpp

index 676d635124b73920fb16d9693b7e1b07e5a72d3b..664dd73708e7ab941dbef89fb7fff3b736bc0cd0 100644 (file)
@@ -128,7 +128,7 @@ TEST(Timekeeper, futureWithinException) {
 
 TEST(Timekeeper, onTimeout) {
   bool flag = false;
-  makeFuture(42).delayed(one_ms)
+  makeFuture(42).delayed(10 * one_ms)
     .onTimeout(zero_ms, [&]{ flag = true; return -1; })
     .get();
   EXPECT_TRUE(flag);
@@ -136,7 +136,7 @@ TEST(Timekeeper, onTimeout) {
 
 TEST(Timekeeper, onTimeoutReturnsFuture) {
   bool flag = false;
-  makeFuture(42).delayed(one_ms)
+  makeFuture(42).delayed(10 * one_ms)
     .onTimeout(zero_ms, [&]{ flag = true; return makeFuture(-1); })
     .get();
   EXPECT_TRUE(flag);