Skip to content

Commit b223f70

Browse files
committed
chore(spanner): add base test case
1 parent accc8f2 commit b223f70

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

google-cloud-spanner/src/test/java/com/google/cloud/spanner/MultiplexedSessionDatabaseClientMockServerTest.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1252,7 +1252,7 @@ public void testMutationOnlyUsingAsyncTransactionManager() {
12521252
request.getPrecommitToken().getPrecommitToken());
12531253
}
12541254

1255-
private Spanner setupSpannerForAbortedBeginTransactionTests() {
1255+
private Spanner setupSpannerBySkippingBeginTransactionVerificationForMux() {
12561256
return SpannerOptions.newBuilder()
12571257
.setProjectId("test-project")
12581258
.setChannelProvider(channelProvider)
@@ -1297,7 +1297,7 @@ public void testMutationOnlyCaseAbortedDuringBeginTransaction() {
12971297
// ABORT error in the BeginTransaction RPC:
12981298
// 1. The mutation key is correctly included in the BeginTransaction request.
12991299
// 2. The precommit token is properly set in the Commit request.
1300-
Spanner spanner = setupSpannerForAbortedBeginTransactionTests();
1300+
Spanner spanner = setupSpannerBySkippingBeginTransactionVerificationForMux();
13011301

13021302
// Force the BeginTransaction RPC to return Aborted the first time it is called. The exception
13031303
// is cleared after the first call, so the retry should succeed.
@@ -1336,7 +1336,7 @@ public void testMutationOnlyUsingTransactionManagerAbortedDuringBeginTransaction
13361336
// ABORT error in the BeginTransaction RPC:
13371337
// 1. The mutation key is correctly included in the BeginTransaction request.
13381338
// 2. The precommit token is properly set in the Commit request.
1339-
Spanner spanner = setupSpannerForAbortedBeginTransactionTests();
1339+
Spanner spanner = setupSpannerBySkippingBeginTransactionVerificationForMux();
13401340

13411341
// Force the BeginTransaction RPC to return Aborted the first time it is called. The exception
13421342
// is cleared after the first call, so the retry should succeed.
@@ -1382,7 +1382,7 @@ public void testMutationOnlyUsingAsyncRunnerAbortedDuringBeginTransaction() {
13821382
// 1. The mutation key is correctly included in the BeginTransaction request.
13831383
// 2. The precommit token is properly set in the Commit request.
13841384

1385-
Spanner spanner = setupSpannerForAbortedBeginTransactionTests();
1385+
Spanner spanner = setupSpannerBySkippingBeginTransactionVerificationForMux();
13861386

13871387
// Force the BeginTransaction RPC to return Aborted the first time it is called. The exception
13881388
// is cleared after the first call, so the retry should succeed.
@@ -1422,7 +1422,7 @@ public void testMutationOnlyUsingTransactionManagerAsyncAbortedDuringBeginTransa
14221422
// ABORT in BeginTransaction RPC, the mutation key is correctly set in the BeginTransaction
14231423
// request
14241424
// and precommit token is set in Commit request.
1425-
Spanner spanner = setupSpannerForAbortedBeginTransactionTests();
1425+
Spanner spanner = setupSpannerBySkippingBeginTransactionVerificationForMux();
14261426

14271427
// Force the BeginTransaction RPC to return Aborted the first time it is called. The exception
14281428
// is cleared after the first call, so the retry should succeed.
@@ -1970,7 +1970,7 @@ public void testBatchWriteAtLeastOnce() {
19701970
// 3. Upon encountering the UNIMPLEMENTED error, the entire transaction callable is retried
19711971
// using regular sessions, but the inline begin fails again.
19721972
// 4. A final retry executes the explicit BeginTransaction on a regular session.
1973-
Spanner spanner = setupSpannerForAbortedBeginTransactionTests();
1973+
Spanner spanner = setupSpannerBySkippingBeginTransactionVerificationForMux();
19741974
mockSpanner.setBeginTransactionExecutionTime(
19751975
SimulatedExecutionTime.ofException(
19761976
Status.UNIMPLEMENTED
@@ -2020,7 +2020,7 @@ public void testBatchWriteAtLeastOnce() {
20202020
// using regular sessions. However, the Commit request fails due to a SessionNotFound error.
20212021
// 3. A final retry is triggered to handle the SessionNotFound error by selecting a new session
20222022
// from the pool, leading to a successful transaction.
2023-
Spanner spanner = setupSpannerForAbortedBeginTransactionTests();
2023+
Spanner spanner = setupSpannerBySkippingBeginTransactionVerificationForMux();
20242024

20252025
// The first ExecuteSql request that does an inline begin with multiplexed sessions fail with
20262026
// UNIMPLEMENTED error.
@@ -2077,7 +2077,7 @@ public void testBatchWriteAtLeastOnce() {
20772077
// 3. Upon encountering the UNIMPLEMENTED error, the entire transaction callable for the second
20782078
// read-write transaction is retried using a regular session.
20792079

2080-
Spanner spanner = setupSpannerForAbortedBeginTransactionTests();
2080+
Spanner spanner = setupSpannerBySkippingBeginTransactionVerificationForMux();
20812081

20822082
DatabaseClientImpl client =
20832083
(DatabaseClientImpl) spanner.getDatabaseClient(DatabaseId.of("p", "i", "d"));

0 commit comments

Comments
 (0)