Skip to content

Commit

Permalink
chore(spanner): skip tests for Retry on differenr grpc channel
Browse files Browse the repository at this point in the history
  • Loading branch information
harshachinta committed Dec 19, 2024
1 parent fed3041 commit 082cec1
Showing 1 changed file with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertThrows;
import static org.junit.Assert.assertTrue;
import static org.junit.Assume.assumeFalse;

import com.google.cloud.NoCredentials;
import com.google.cloud.spanner.MockSpannerServiceImpl.SimulatedExecutionTime;
Expand Down Expand Up @@ -133,6 +134,9 @@ public void testReadWriteTransaction_retriesOnNewChannel() {
AtomicInteger attempts = new AtomicInteger();

try (Spanner spanner = builder.build().getService()) {
assumeFalse(
"RetryOnDifferentGrpcChannel handler is not implemented for read-write with multiplexed sessions",
isMultiplexedSessionsEnabledForRW(spanner));
DatabaseClient client = spanner.getDatabaseClient(DatabaseId.of("p", "i", "d"));
client
.readWriteTransaction()
Expand Down Expand Up @@ -168,6 +172,9 @@ public void testReadWriteTransaction_stopsRetrying() {
SimulatedExecutionTime.ofStickyException(Status.DEADLINE_EXCEEDED.asRuntimeException()));

try (Spanner spanner = builder.build().getService()) {
assumeFalse(
"RetryOnDifferentGrpcChannel handler is not implemented for read-write with multiplexed sessions",
isMultiplexedSessionsEnabledForRW(spanner));
DatabaseClient client = spanner.getDatabaseClient(DatabaseId.of("p", "i", "d"));
SpannerException exception =
assertThrows(
Expand Down Expand Up @@ -211,6 +218,9 @@ public void testDenyListedChannelIsCleared() {
SimulatedExecutionTime.ofStickyException(Status.DEADLINE_EXCEEDED.asRuntimeException()));

try (Spanner spanner = builder.build().getService()) {
assumeFalse(
"RetryOnDifferentGrpcChannel handler is not implemented for read-write with multiplexed sessions",
isMultiplexedSessionsEnabledForRW(spanner));
DatabaseClient client = spanner.getDatabaseClient(DatabaseId.of("p", "i", "d"));

// Retry until all channels have been deny-listed.
Expand Down Expand Up @@ -339,6 +349,9 @@ public void testReadWriteTransaction_withGrpcContextDeadline_doesNotRetry() {
SimulatedExecutionTime.ofMinimumAndRandomTime(500, 500));

try (Spanner spanner = builder.build().getService()) {
assumeFalse(
"RetryOnDifferentGrpcChannel handler is not implemented for read-write with multiplexed sessions",
isMultiplexedSessionsEnabledForRW(spanner));
DatabaseClient client = spanner.getDatabaseClient(DatabaseId.of("p", "i", "d"));
ScheduledExecutorService service = Executors.newScheduledThreadPool(1);
Context context =
Expand All @@ -365,4 +378,11 @@ public void testReadWriteTransaction_withGrpcContextDeadline_doesNotRetry() {
// up.
assertEquals(1, mockSpanner.countRequestsOfType(BeginTransactionRequest.class));
}

private boolean isMultiplexedSessionsEnabledForRW(Spanner spanner) {
if (spanner.getOptions() == null || spanner.getOptions().getSessionPoolOptions() == null) {
return false;
}
return spanner.getOptions().getSessionPoolOptions().getUseMultiplexedSessionForRW();
}
}

0 comments on commit 082cec1

Please sign in to comment.