Skip to content

Commit

Permalink
Log start of test and don't wait forever
Browse files Browse the repository at this point in the history
With this, the test should no longer time out in case of error and there
is more information available to determine which test has issues if
there are further problems.
  • Loading branch information
ejona86 committed Jan 25, 2016
1 parent c70a769 commit 7677525
Showing 1 changed file with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ public void shutdown() {
}

public void runTest(String testCase) throws Exception {
Log.i(TesterActivity.LOG_TAG, "Running test " + testCase);
if ("all".equals(testCase)) {
runTest("empty_unary");
runTest("large_unary");
Expand Down Expand Up @@ -302,7 +303,7 @@ public void serverStreaming() throws Exception {

StreamRecorder<Messages.StreamingOutputCallResponse> recorder = StreamRecorder.create();
asyncStub.streamingOutputCall(request, recorder);
recorder.awaitCompletion();
assertTrue(recorder.awaitCompletion(TIMEOUT_MILLIS, TimeUnit.MILLISECONDS));
assertSuccess(recorder);
assertMessageEquals(Arrays.asList(goldenResponses), recorder.getValues());
}
Expand Down Expand Up @@ -397,7 +398,7 @@ public void cancelAfterBegin() throws Exception {
StreamObserver<StreamingInputCallRequest> requestObserver =
asyncStub.streamingInputCall(responseObserver);
requestObserver.onError(new RuntimeException());
responseObserver.awaitCompletion();
assertTrue(responseObserver.awaitCompletion(TIMEOUT_MILLIS, TimeUnit.MILLISECONDS));
assertEquals(Arrays.<StreamingInputCallResponse>asList(), responseObserver.getValues());
assertEquals(io.grpc.Status.CANCELLED.getCode(),
io.grpc.Status.fromThrowable(responseObserver.getError()).getCode());
Expand Down Expand Up @@ -455,7 +456,7 @@ public void fullDuplexCallShouldSucceed() throws Exception {
requestStream.onNext(request);
}
requestStream.onCompleted();
recorder.awaitCompletion();
assertTrue(recorder.awaitCompletion(TIMEOUT_MILLIS, TimeUnit.MILLISECONDS));
assertSuccess(recorder);
assertEquals(responseSizes.length * numRequests, recorder.getValues().size());
for (int ix = 0; ix < recorder.getValues().size(); ++ix) {
Expand Down Expand Up @@ -487,7 +488,7 @@ public void halfDuplexCallShouldSucceed() throws Exception {
requestStream.onNext(request);
}
requestStream.onCompleted();
recorder.awaitCompletion();
assertTrue(recorder.awaitCompletion(TIMEOUT_MILLIS, TimeUnit.MILLISECONDS));
assertSuccess(recorder);
assertEquals(responseSizes.length * numRequests, recorder.getValues().size());
for (int ix = 0; ix < recorder.getValues().size(); ++ix) {
Expand Down Expand Up @@ -634,7 +635,7 @@ public void deadlineExceededServerStreaming() throws Exception {
TestServiceGrpc.newStub(channel)
.withDeadlineAfter(30, TimeUnit.MILLISECONDS)
.streamingOutputCall(request, recorder);
recorder.awaitCompletion();
assertTrue(recorder.awaitCompletion(TIMEOUT_MILLIS, TimeUnit.MILLISECONDS));
assertEquals(io.grpc.Status.DEADLINE_EXCEEDED.getCode(),
io.grpc.Status.fromThrowable(recorder.getError()).getCode());
}
Expand Down Expand Up @@ -732,7 +733,7 @@ public void timeoutOnSleepingServer() throws Exception {
// This can happen if the stream has already been terminated due to deadline exceeded.
}

recorder.awaitCompletion();
assertTrue(recorder.awaitCompletion(TIMEOUT_MILLIS, TimeUnit.MILLISECONDS));
assertEquals(io.grpc.Status.DEADLINE_EXCEEDED.getCode(),
io.grpc.Status.fromThrowable(recorder.getError()).getCode());
}
Expand Down

0 comments on commit 7677525

Please sign in to comment.