interop client: fix soak test bug where we can crash if peer wasn't set

This commit is contained in:
apolcyn 2022-07-15 15:54:54 -07:00 committed by GitHub
parent 4cb1fbaa9f
commit 267d15412f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -2054,12 +2054,12 @@ public abstract class AbstractInteropTest {
.withInterceptors(recordClientCallInterceptor(clientCallCapture));
}
SoakIterationResult result = performOneSoakIteration(soakStub);
String peer = clientCallCapture
.get().getAttributes().get(Grpc.TRANSPORT_ATTR_REMOTE_ADDR).toString();
SocketAddress peer = clientCallCapture
.get().getAttributes().get(Grpc.TRANSPORT_ATTR_REMOTE_ADDR);
System.err.print(
String.format(
"soak iteration: %d elapsed_ms: %d peer: %s",
i, result.getLatencyMs(), peer));
i, result.getLatencyMs(), peer != null ? peer.toString() : "null"));
if (!result.getStatus().equals(Status.OK)) {
totalFailures++;
System.err.println(String.format(" failed: %s", result.getStatus()));