From f39770d6905d3d1099e1c14c512e7f77a15b4d23 Mon Sep 17 00:00:00 2001 From: edwinwu Date: Wed, 25 May 2022 06:44:35 -0700 Subject: [PATCH] Fixes Flaky test by set larger timer(100 ->1000 ms) for CancelableAlarm. PiperOrigin-RevId: 450911652 --- internal/platform/cancelable_alarm_test.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/platform/cancelable_alarm_test.cc b/internal/platform/cancelable_alarm_test.cc index bde8524e..8dfd2970 100644 --- a/internal/platform/cancelable_alarm_test.cc +++ b/internal/platform/cancelable_alarm_test.cc @@ -70,9 +70,9 @@ TEST(CancelableAlarmTest, CanCreateRecurringAlarm) { AtomicReference count(0); CancelableAlarm alarm( "test_alarm", [&count]() { count.Set(count.Get() + 1); }, - absl::Milliseconds(100), &alarm_executor, /*is_recurring=*/true); - // Wait for 2 rounds (>100ms * 2) and expect the `count` = 2. - SystemClock::Sleep(absl::Milliseconds(290)); + absl::Milliseconds(1000), &alarm_executor, /*is_recurring=*/true); + // Wait for 2 rounds (>1000ms * 2) and expect the `count` = 2. + SystemClock::Sleep(absl::Milliseconds(2800)); alarm.Cancel(); EXPECT_EQ(count.Get(), 2); }