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.
This commit is contained in:
Eric Anderson 2016-07-18 10:10:16 -07:00
parent 4289aaf79c
commit 2cd884ea80
1 changed files with 1 additions and 1 deletions

View File

@ -81,7 +81,7 @@ public class DeadlineTest {
ticker.reset(System.nanoTime()); ticker.reset(System.nanoTime());
Deadline reference = Deadline.after(0, TimeUnit.SECONDS, ticker); Deadline reference = Deadline.after(0, TimeUnit.SECONDS, ticker);
// Allow inaccuracy to account for system time advancing during test. // 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 @Test