Skip to content

Commit b8b5aed

Browse files
authored
test(spanner): update non-retryable error code in unit tests (#3176)
1 parent 89c09ce commit b8b5aed

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ public void asyncRunnerUpdateAbortedWithoutGettingResult() throws Exception {
229229
public void asyncRunnerCommitFails() throws Exception {
230230
mockSpanner.setCommitExecutionTime(
231231
SimulatedExecutionTime.ofException(
232-
Status.RESOURCE_EXHAUSTED
232+
Status.INVALID_ARGUMENT
233233
.withDescription("mutation limit exceeded")
234234
.asRuntimeException()));
235235
AsyncRunner runner = client().runAsync();
@@ -245,7 +245,7 @@ public void asyncRunnerCommitFails() throws Exception {
245245
ExecutionException e = assertThrows(ExecutionException.class, () -> updateCount.get());
246246
assertThat(e.getCause()).isInstanceOf(SpannerException.class);
247247
SpannerException se = (SpannerException) e.getCause();
248-
assertThat(se.getErrorCode()).isEqualTo(ErrorCode.RESOURCE_EXHAUSTED);
248+
assertThat(se.getErrorCode()).isEqualTo(ErrorCode.INVALID_ARGUMENT);
249249
assertThat(se.getMessage()).contains("mutation limit exceeded");
250250
}
251251

@@ -432,7 +432,7 @@ public void asyncRunnerBatchUpdateAbortedWithoutGettingResult() throws Exception
432432
public void asyncRunnerWithBatchUpdateCommitFails() throws Exception {
433433
mockSpanner.setCommitExecutionTime(
434434
SimulatedExecutionTime.ofException(
435-
Status.RESOURCE_EXHAUSTED
435+
Status.INVALID_ARGUMENT
436436
.withDescription("mutation limit exceeded")
437437
.asRuntimeException()));
438438
AsyncRunner runner = client().runAsync();
@@ -448,7 +448,7 @@ public void asyncRunnerWithBatchUpdateCommitFails() throws Exception {
448448
ExecutionException e = assertThrows(ExecutionException.class, () -> updateCount.get());
449449
assertThat(e.getCause()).isInstanceOf(SpannerException.class);
450450
SpannerException se = (SpannerException) e.getCause();
451-
assertThat(se.getErrorCode()).isEqualTo(ErrorCode.RESOURCE_EXHAUSTED);
451+
assertThat(se.getErrorCode()).isEqualTo(ErrorCode.INVALID_ARGUMENT);
452452
assertThat(se.getMessage()).contains("mutation limit exceeded");
453453
}
454454

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -531,7 +531,7 @@ public void asyncTransactionManagerUpdateAbortedWithoutGettingResult() throws Ex
531531
public void asyncTransactionManagerCommitFails() throws Exception {
532532
mockSpanner.setCommitExecutionTime(
533533
SimulatedExecutionTime.ofException(
534-
Status.RESOURCE_EXHAUSTED
534+
Status.INVALID_ARGUMENT
535535
.withDescription("mutation limit exceeded")
536536
.asRuntimeException()));
537537
try (AsyncTransactionManager mgr = client().transactionManagerAsync()) {
@@ -545,7 +545,7 @@ public void asyncTransactionManagerCommitFails() throws Exception {
545545
AsyncTransactionManagerHelper.executeUpdateAsync(UPDATE_STATEMENT),
546546
executor)
547547
.commitAsync()));
548-
assertThat(e.getErrorCode()).isEqualTo(ErrorCode.RESOURCE_EXHAUSTED);
548+
assertThat(e.getErrorCode()).isEqualTo(ErrorCode.INVALID_ARGUMENT);
549549
assertThat(e.getMessage()).contains("mutation limit exceeded");
550550
}
551551
}
@@ -928,7 +928,7 @@ public void asyncTransactionManagerBatchUpdateAbortedWithoutGettingResult() thro
928928
public void asyncTransactionManagerWithBatchUpdateCommitFails() throws Exception {
929929
mockSpanner.setCommitExecutionTime(
930930
SimulatedExecutionTime.ofException(
931-
Status.RESOURCE_EXHAUSTED
931+
Status.INVALID_ARGUMENT
932932
.withDescription("mutation limit exceeded")
933933
.asRuntimeException()));
934934
try (AsyncTransactionManager manager = clientWithEmptySessionPool().transactionManagerAsync()) {
@@ -945,7 +945,7 @@ public void asyncTransactionManagerWithBatchUpdateCommitFails() throws Exception
945945
ImmutableList.of(UPDATE_STATEMENT, UPDATE_STATEMENT)),
946946
executor)
947947
.commitAsync()));
948-
assertThat(e.getErrorCode()).isEqualTo(ErrorCode.RESOURCE_EXHAUSTED);
948+
assertThat(e.getErrorCode()).isEqualTo(ErrorCode.INVALID_ARGUMENT);
949949
assertThat(e.getMessage()).contains("mutation limit exceeded");
950950
}
951951
if (isMultiplexedSessionsEnabled()) {

0 commit comments

Comments
 (0)