Skip to content

Commit

Permalink
feat: Convert internal interfaces to use protos
Browse files Browse the repository at this point in the history
  • Loading branch information
dpcollins-google committed Feb 20, 2023
1 parent c14b41b commit b8148ec
Showing 1 changed file with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -224,10 +224,18 @@ public void commitResponseProxied() {

@Test
public void receiveTimeout_closesConnection() throws Exception {
CountDownLatch connectionClosed = new CountDownLatch(1);
CountDownLatch requestClosed = new CountDownLatch(1);
doAnswer(
args -> {
connectionClosed.countDown();
requestClosed.countDown();
return null;
})
.when(mockRequestStream)
.closeSendWithError(any());
CountDownLatch outputClosed = new CountDownLatch(1);
doAnswer(
args -> {
outputClosed.countDown();
return null;
})
.when(mockOutputStream)
Expand All @@ -245,7 +253,8 @@ public void receiveTimeout_closesConnection() throws Exception {
verify(mockRequestStream).send(initialRequest());

// No subsequent stream responses should close the stream.
assertThat(connectionClosed.await(30, SECONDS)).isTrue();
assertThat(requestClosed.await(30, SECONDS)).isTrue();
assertThat(outputClosed.await(30, SECONDS)).isTrue();

verify(mockRequestStream).closeSendWithError(argThat(new ApiExceptionMatcher(Code.ABORTED)));
verify(mockOutputStream).onError(argThat(new ApiExceptionMatcher(Code.ABORTED)));
Expand Down

0 comments on commit b8148ec

Please sign in to comment.