Skip to content

test(spanner): update non-retryable error code in unit tests #3176

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 25, 2024
Merged
Show file tree
Hide file tree
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 @@ -229,7 +229,7 @@ public void asyncRunnerUpdateAbortedWithoutGettingResult() throws Exception {
public void asyncRunnerCommitFails() throws Exception {
mockSpanner.setCommitExecutionTime(
SimulatedExecutionTime.ofException(
Status.RESOURCE_EXHAUSTED
Status.INVALID_ARGUMENT
.withDescription("mutation limit exceeded")
.asRuntimeException()));
AsyncRunner runner = client().runAsync();
Expand All @@ -245,7 +245,7 @@ public void asyncRunnerCommitFails() throws Exception {
ExecutionException e = assertThrows(ExecutionException.class, () -> updateCount.get());
assertThat(e.getCause()).isInstanceOf(SpannerException.class);
SpannerException se = (SpannerException) e.getCause();
assertThat(se.getErrorCode()).isEqualTo(ErrorCode.RESOURCE_EXHAUSTED);
assertThat(se.getErrorCode()).isEqualTo(ErrorCode.INVALID_ARGUMENT);
assertThat(se.getMessage()).contains("mutation limit exceeded");
}

Expand Down Expand Up @@ -432,7 +432,7 @@ public void asyncRunnerBatchUpdateAbortedWithoutGettingResult() throws Exception
public void asyncRunnerWithBatchUpdateCommitFails() throws Exception {
mockSpanner.setCommitExecutionTime(
SimulatedExecutionTime.ofException(
Status.RESOURCE_EXHAUSTED
Status.INVALID_ARGUMENT
.withDescription("mutation limit exceeded")
.asRuntimeException()));
AsyncRunner runner = client().runAsync();
Expand All @@ -448,7 +448,7 @@ public void asyncRunnerWithBatchUpdateCommitFails() throws Exception {
ExecutionException e = assertThrows(ExecutionException.class, () -> updateCount.get());
assertThat(e.getCause()).isInstanceOf(SpannerException.class);
SpannerException se = (SpannerException) e.getCause();
assertThat(se.getErrorCode()).isEqualTo(ErrorCode.RESOURCE_EXHAUSTED);
assertThat(se.getErrorCode()).isEqualTo(ErrorCode.INVALID_ARGUMENT);
assertThat(se.getMessage()).contains("mutation limit exceeded");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,7 @@ public void asyncTransactionManagerUpdateAbortedWithoutGettingResult() throws Ex
public void asyncTransactionManagerCommitFails() throws Exception {
mockSpanner.setCommitExecutionTime(
SimulatedExecutionTime.ofException(
Status.RESOURCE_EXHAUSTED
Status.INVALID_ARGUMENT
.withDescription("mutation limit exceeded")
.asRuntimeException()));
try (AsyncTransactionManager mgr = client().transactionManagerAsync()) {
Expand All @@ -545,7 +545,7 @@ public void asyncTransactionManagerCommitFails() throws Exception {
AsyncTransactionManagerHelper.executeUpdateAsync(UPDATE_STATEMENT),
executor)
.commitAsync()));
assertThat(e.getErrorCode()).isEqualTo(ErrorCode.RESOURCE_EXHAUSTED);
assertThat(e.getErrorCode()).isEqualTo(ErrorCode.INVALID_ARGUMENT);
assertThat(e.getMessage()).contains("mutation limit exceeded");
}
}
Expand Down Expand Up @@ -928,7 +928,7 @@ public void asyncTransactionManagerBatchUpdateAbortedWithoutGettingResult() thro
public void asyncTransactionManagerWithBatchUpdateCommitFails() throws Exception {
mockSpanner.setCommitExecutionTime(
SimulatedExecutionTime.ofException(
Status.RESOURCE_EXHAUSTED
Status.INVALID_ARGUMENT
.withDescription("mutation limit exceeded")
.asRuntimeException()));
try (AsyncTransactionManager manager = clientWithEmptySessionPool().transactionManagerAsync()) {
Expand All @@ -945,7 +945,7 @@ public void asyncTransactionManagerWithBatchUpdateCommitFails() throws Exception
ImmutableList.of(UPDATE_STATEMENT, UPDATE_STATEMENT)),
executor)
.commitAsync()));
assertThat(e.getErrorCode()).isEqualTo(ErrorCode.RESOURCE_EXHAUSTED);
assertThat(e.getErrorCode()).isEqualTo(ErrorCode.INVALID_ARGUMENT);
assertThat(e.getMessage()).contains("mutation limit exceeded");
}
if (isMultiplexedSessionsEnabled()) {
Expand Down
Loading