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 @@ -21,6 +21,7 @@
import static org.hamcrest.CoreMatchers.notNullValue;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.fail;
import static org.junit.Assume.assumeFalse;

import com.google.cloud.spanner.ErrorCode;
import com.google.cloud.spanner.Mutation;
Expand Down Expand Up @@ -73,6 +74,9 @@ public void test02_WriteMutation() {

@Test
public void test03_MultipleStatements_WithTimeouts() {
assumeFalse(
"Rolling back a transaction while an update statement is still in flight can cause the transaction to remain active on the emulator",
env.getTestHelper().isEmulator());
try (ITConnection connection = createConnection()) {
// do an insert that should succeed
assertThat(
Expand All @@ -91,10 +95,9 @@ public void test03_MultipleStatements_WithTimeouts() {
connection.setStatementTimeout(1L, TimeUnit.MILLISECONDS);
try {
connection.executeUpdate(Statement.of("UPDATE TEST SET NAME='test18' WHERE ID=1000"));
fail("missing expected exception");
} catch (SpannerException e) {
if (e.getErrorCode() != ErrorCode.DEADLINE_EXCEEDED) {
throw e;
}
assertThat(e.getErrorCode(), is(equalTo(ErrorCode.DEADLINE_EXCEEDED)));
}
// remove the timeout setting
connection.clearStatementTimeout();
Expand Down