From 2cd884ea803d2cb756b9ad6b642ece4bc5c9cbc9 Mon Sep 17 00:00:00 2001 From: Eric Anderson Date: Mon, 18 Jul 2016 10:10:16 -0700 Subject: [PATCH] core: Reduce DeadlineTest flake To my knowledge, there has been just a single DeadlineTest flake since the code was fixed to avoid issues with I/O due to class loading: io.grpc.DeadlineTest > defaultTickerIsSystemTicker[0] FAILED java.lang.AssertionError: <-21431071 ns from now> and <0 ns from now> should have been within <20000000ns> of each other But we don't really need fine-grained verification during the test though; if the code is not using nanoTime, then it is almost certainly not going to have even a day of accuracy (except on a fresh VM). So checking for a second of accuracy vs 20ms shouldn't really be an issue. --- core/src/test/java/io/grpc/DeadlineTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/test/java/io/grpc/DeadlineTest.java b/core/src/test/java/io/grpc/DeadlineTest.java index 658c9019e7..2df9959d32 100644 --- a/core/src/test/java/io/grpc/DeadlineTest.java +++ b/core/src/test/java/io/grpc/DeadlineTest.java @@ -81,7 +81,7 @@ public class DeadlineTest { ticker.reset(System.nanoTime()); Deadline reference = Deadline.after(0, TimeUnit.SECONDS, ticker); // Allow inaccuracy to account for system time advancing during test. - assertAbout(deadline()).that(d).isWithin(20, TimeUnit.MILLISECONDS).of(reference); + assertAbout(deadline()).that(d).isWithin(1, TimeUnit.SECONDS).of(reference); } @Test