From 83bf5e6f421669a1b04e05f7d9ac73a03cb2eb34 Mon Sep 17 00:00:00 2001 From: Eric Anderson Date: Fri, 6 May 2016 08:54:47 -0700 Subject: [PATCH] Fix flakiness of testConfigureDeadlineNanoTime with warmup Without the warm up I saw large deltas, like 2,262,968ns and 1,712,558ns, on my machine. With the single-line warm up the deltas decreased dramitically, like 385ns and 536ns. Since our times are so much better now, decreasing the required delta to 10ms seems reasonable. This would seem to support the theory that the flakiness was caused by the class loader, which may even be doing I/O. Fixes #1646 --- .../src/test/java/io/grpc/stub/StubConfigTest.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/interop-testing/src/test/java/io/grpc/stub/StubConfigTest.java b/interop-testing/src/test/java/io/grpc/stub/StubConfigTest.java index 2ff8a19749..02f4e4b4f8 100644 --- a/interop-testing/src/test/java/io/grpc/stub/StubConfigTest.java +++ b/interop-testing/src/test/java/io/grpc/stub/StubConfigTest.java @@ -107,11 +107,13 @@ public class StubConfigTest { // Create a default stub TestServiceGrpc.TestServiceBlockingStub stub = TestServiceGrpc.newBlockingStub(channel); assertNull(stub.getCallOptions().getDeadlineNanoTime()); + // Warm up JVM + stub.withDeadlineNanoTime(deadline); // Reconfigure it TestServiceGrpc.TestServiceBlockingStub reconfiguredStub = stub.withDeadlineNanoTime(deadline); // New altered config assertNotNull(reconfiguredStub.getCallOptions().getDeadlineNanoTime()); - long maxDelta = MILLISECONDS.toNanos(30); + long maxDelta = MILLISECONDS.toNanos(10); long actualDelta = Math.abs(reconfiguredStub.getCallOptions().getDeadlineNanoTime() - deadline); assertTrue(maxDelta + " < " + actualDelta, maxDelta >= actualDelta); // Default config unchanged