Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import static com.google.cloud.bigtable.data.v2.internal.test_helpers.StatusSubject.assertThat;
import static com.google.cloud.bigtable.data.v2.internal.test_helpers.VRpcResultSubject.assertThat;
import static com.google.common.truth.Truth.assertThat;
import static com.google.common.truth.Truth.assertWithMessage;
import static org.junit.jupiter.api.Assertions.assertThrows;

import com.google.bigtable.v2.CloseSessionRequest;
Expand Down Expand Up @@ -201,6 +202,8 @@ void sessionGoAwayTest() throws Exception {

// Send vRPCs until after a goaway time
Stopwatch stopwatch = Stopwatch.createStarted();
int numUncommittedErrors = 0;
int numOk = 0;
while (stopwatch.elapsed(TimeUnit.MILLISECONDS) < goAwayDelay.toMillis()) {
VRpc<SessionFakeScriptedRequest, SessionFakeScriptedResponse> rpc =
session.newCall(FakeDescriptor.SCRIPTED);
Expand All @@ -209,9 +212,23 @@ void sessionGoAwayTest() throws Exception {
SessionFakeScriptedRequest.newBuilder().setTag(0).build(),
VRpcCallContext.create(Deadline.after(1, TimeUnit.MINUTES), true, tracer),
f);
f.get();
try {
f.get();
numOk++;
} catch (VRpcException e) {
if (e.getResult().getState() == State.UNCOMMITED) {
numUncommittedErrors++;
}
}
}

assertWithMessage("Ensure that some vRpcs succeeded prior to the goaway")
.that(numOk)
.isGreaterThan(0);
assertWithMessage("Ensure that only the last vRpc could be rejected with an uncommited error")
.that(numUncommittedErrors)
.isAtMost(1);

assertThat(sessionListener.popUntil(GoAwayResponse.class)).isInstanceOf(GoAwayResponse.class);

// Make sure we can't send vrpc after receiving goaway
Expand Down
Loading