context, stub: check result of CountDownLatch.await() in test (#6664)

This commit is contained in:
Chengyuan Zhang 2020-01-31 15:03:22 -08:00 committed by GitHub
parent 307f7d0e09
commit 2734e22ef5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -609,7 +609,7 @@ public class ContextTest {
latch.countDown();
}
}, MoreExecutors.directExecutor());
latch.await(3, TimeUnit.SECONDS);
assertTrue("cancellation failed", latch.await(3, TimeUnit.SECONDS));
if (error.get() != null) {
throw error.get();
}

View File

@ -498,7 +498,7 @@ public class ServerCallsTest {
semaphore.acquire();
clientCall.request(3);
clientCall.halfClose();
latch.await(5, TimeUnit.SECONDS);
assertThat(latch.await(5, TimeUnit.SECONDS)).isTrue();
// Very that number of messages produced in each onReady handler call matches the number
// requested by the client.
assertArrayEquals(new int[]{0, 1, 1, 2, 2, 2}, receivedMessages);