Skip to content

Commit 6201db2

Browse files
committed
Fix aarch64 emulation-triggered flakes
Because we are emulating aarch64 during testing the tests run slower than normal. Bumping the timeout seems easy and obvious for StressTestClientTest. The warmup for BinlogHelperTest mirrors what we've done with timing-based tests in the past. Hopefully that is enough to lower variance so that it passes consistently; seems likely. I'd rather not increase the timing fuzziness if I can avoid it, as that reduces the test's ability to detect issues. Fixes grpc#8135 (mostly+hopefully)
1 parent 814655c commit 6201db2

File tree

2 files changed

+21
-23
lines changed

2 files changed

+21
-23
lines changed

interop-testing/src/test/java/io/grpc/testing/integration/StressTestClientTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
public class StressTestClientTest {
4646

4747
@Rule
48-
public final Timeout globalTimeout = Timeout.seconds(5);
48+
public final Timeout globalTimeout = Timeout.seconds(10);
4949

5050
@Test
5151
public void ipv6AddressesShouldBeSupported() {

services/src/test/java/io/grpc/protobuf/services/BinlogHelperTest.java

Lines changed: 20 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -928,18 +928,32 @@ public void getPeerSocketTest() {
928928

929929
@Test
930930
public void serverDeadlineLogged() {
931-
final AtomicReference<ServerCall<byte[], byte[]>> interceptedCall =
932-
new AtomicReference<>();
933-
@SuppressWarnings("unchecked")
934-
final ServerCall.Listener<byte[]> mockListener = mock(ServerCall.Listener.class);
935-
936931
final MethodDescriptor<byte[], byte[]> method =
937932
MethodDescriptor.<byte[], byte[]>newBuilder()
938933
.setType(MethodType.UNKNOWN)
939934
.setFullMethodName("service/method")
940935
.setRequestMarshaller(BYTEARRAY_MARSHALLER)
941936
.setResponseMarshaller(BYTEARRAY_MARSHALLER)
942937
.build();
938+
final ServerCall<byte[], byte[]> noopServerCall = new NoopServerCall<byte[], byte[]>() {
939+
@Override
940+
public MethodDescriptor<byte[], byte[]> getMethodDescriptor() {
941+
return method;
942+
}
943+
};
944+
final ServerCallHandler<byte[], byte[]> noopHandler = new ServerCallHandler<byte[], byte[]>() {
945+
@Override
946+
public ServerCall.Listener<byte[]> startCall(
947+
ServerCall<byte[], byte[]> call,
948+
Metadata headers) {
949+
return new ServerCall.Listener<byte[]>() {};
950+
}
951+
};
952+
953+
// Warm-up JVM
954+
new BinlogHelper(mock(SinkWriter.class))
955+
.getServerInterceptor(1234)
956+
.interceptCall(noopServerCall, new Metadata(), noopHandler);
943957

944958
// We expect the contents of the "grpc-timeout" header to be installed the context
945959
Context.current()
@@ -950,23 +964,7 @@ public void run() {
950964
ServerCall.Listener<byte[]> unused =
951965
new BinlogHelper(mockSinkWriter)
952966
.getServerInterceptor(CALL_ID)
953-
.interceptCall(
954-
new NoopServerCall<byte[], byte[]>() {
955-
@Override
956-
public MethodDescriptor<byte[], byte[]> getMethodDescriptor() {
957-
return method;
958-
}
959-
},
960-
new Metadata(),
961-
new ServerCallHandler<byte[], byte[]>() {
962-
@Override
963-
public ServerCall.Listener<byte[]> startCall(
964-
ServerCall<byte[], byte[]> call,
965-
Metadata headers) {
966-
interceptedCall.set(call);
967-
return mockListener;
968-
}
969-
});
967+
.interceptCall(noopServerCall, new Metadata(), noopHandler);
970968
}
971969
});
972970
ArgumentCaptor<Duration> timeoutCaptor = ArgumentCaptor.forClass(Duration.class);

0 commit comments

Comments
 (0)