Skip to content

Commit

Permalink
tests: fixes sql script test (#469)
Browse files Browse the repository at this point in the history
In version 6.4.4 of spanner we have change the verifyStatementsInFile
method to wrap any SQLExceptions into SpannerExceptions.
In the failing tests we were catching SQLExceptions and ignoring them,
since they were expected.

We have changed the tests to also ignore the respective
SpannerExceptions.
  • Loading branch information
thiagotnunes committed May 18, 2021
1 parent def3aaa commit 8e86e5f
Showing 1 changed file with 11 additions and 0 deletions.
Expand Up @@ -23,6 +23,7 @@

import com.google.cloud.spanner.ErrorCode;
import com.google.cloud.spanner.IntegrationTest;
import com.google.cloud.spanner.SpannerException;
import com.google.cloud.spanner.connection.SqlScriptVerifier;
import com.google.cloud.spanner.jdbc.ITAbstractJdbcTest;
import com.google.cloud.spanner.jdbc.JdbcSqlScriptVerifier;
Expand Down Expand Up @@ -93,6 +94,11 @@ public void test02_InsertTestData() throws Exception {
// Ignore, this is expected as errors during a read/write transaction are sticky on the
// emulator.
}
} catch (SpannerException e) {
if (env.getTestHelper().isEmulator() && e.getErrorCode() == ErrorCode.ALREADY_EXISTS) {
// Ignore, this is expected as errors during a read/write transaction are sticky on the
// emulator.
}
}
}

Expand All @@ -114,6 +120,11 @@ public void test04_TestGetCommitTimestamp() throws Exception {
&& e.getErrorCode() == ErrorCode.INVALID_ARGUMENT.getGrpcStatusCode().value()) {
// Ignore as errors during read/write transactions are sticky on the emulator.
}
} catch (SpannerException e) {
if (env.getTestHelper().isEmulator() && e.getErrorCode() == ErrorCode.ALREADY_EXISTS) {
// Ignore, this is expected as errors during a read/write transaction are sticky on the
// emulator.
}
}
}

Expand Down

0 comments on commit 8e86e5f

Please sign in to comment.