Skip to content

Commit 055ab59

Browse files
Fix emulator tests
1 parent b4a46b5 commit 055ab59

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

google-cloud-spanner/src/test/java/com/google/cloud/spanner/it/ITDatabaseTest.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,9 @@ public void databaseDeletedTest() throws Exception {
150150
}
151151
}
152152
}
153-
assertThat(notFoundException).isNotNull();
153+
if(!isUsingEmulator()) {
154+
assertThat(notFoundException).isNotNull();
155+
}
154156

155157
// Now get a new DatabaseClient for the database. This should now result in a valid
156158
// DatabaseClient.

google-cloud-spanner/src/test/java/com/google/cloud/spanner/it/ITJsonWriteReadTest.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
package com.google.cloud.spanner.it;
1818

19+
import static com.google.cloud.spanner.testing.EmulatorSpannerHelper.isUsingEmulator;
1920
import static org.junit.Assert.assertEquals;
2021
import static org.junit.Assert.assertThrows;
2122

@@ -29,6 +30,7 @@
2930
import com.google.cloud.spanner.SpannerException;
3031
import com.google.cloud.spanner.Statement;
3132
import com.google.cloud.spanner.Value;
33+
import com.google.cloud.spanner.testing.EmulatorSpannerHelper;
3234
import com.google.cloud.spanner.testing.RemoteSpannerHelper;
3335
import com.google.common.io.Resources;
3436
import java.io.File;
@@ -135,7 +137,7 @@ public void testWriteAndReadInvalidJsonValues() throws IOException {
135137
if (env.getTestHelper()
136138
.getOptions()
137139
.getSessionPoolOptions()
138-
.getUseMultiplexedSessionForRW()) {
140+
.getUseMultiplexedSessionForRW() && !isUsingEmulator()) {
139141
assertEquals(ErrorCode.INVALID_ARGUMENT, exception.getErrorCode());
140142
} else {
141143
assertEquals(ErrorCode.FAILED_PRECONDITION, exception.getErrorCode());

google-cloud-spanner/src/test/java/com/google/cloud/spanner/it/ITWriteTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1084,7 +1084,7 @@ public void incorrectType() {
10841084
if (env.getTestHelper()
10851085
.getOptions()
10861086
.getSessionPoolOptions()
1087-
.getUseMultiplexedSessionForRW()) {
1087+
.getUseMultiplexedSessionForRW() && !isUsingEmulator()) {
10881088
assertThat(ex.getErrorCode()).isEqualTo(ErrorCode.INVALID_ARGUMENT);
10891089
} else {
10901090
assertThat(ex.getErrorCode()).isEqualTo(ErrorCode.FAILED_PRECONDITION);

0 commit comments

Comments
 (0)