Skip to content

Commit a7378f8

Browse files
authored
tests: skip autocommit timeout test on emulator (#320)
1 parent 9665f3a commit a7378f8

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/it/ITReadWriteAutocommitSpannerTest.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import static org.hamcrest.CoreMatchers.notNullValue;
2222
import static org.hamcrest.MatcherAssert.assertThat;
2323
import static org.junit.Assert.fail;
24+
import static org.junit.Assume.assumeFalse;
2425

2526
import com.google.cloud.spanner.ErrorCode;
2627
import com.google.cloud.spanner.Mutation;
@@ -73,6 +74,9 @@ public void test02_WriteMutation() {
7374

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

0 commit comments

Comments
 (0)