Skip to content

Commit 0702b20

Browse files
authored
test: fix flaky integration test (#45)
The ITClosedSessionTest could cause a flaky failure because it deletes sessions on the server and then repeatedly executes queries on the session until it returns a NOT_FOUND error. The actual deletion could however happen exactly at the moment that the test query was executed, which will cause Cloud Spanner to return a different error message than the standard 'Session not found' error message. Fixes #41
1 parent c9864e5 commit 0702b20

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

google-cloud-spanner/src/test/java/com/google/cloud/spanner/IntegrationTestWithClosedSessionsEnv.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,8 @@ private void awaitDeleted(Session session) {
114114
Thread.sleep(500L);
115115
} catch (SpannerException e) {
116116
if (e.getErrorCode() == ErrorCode.NOT_FOUND
117-
&& e.getMessage().contains("Session not found")) {
117+
&& (e.getMessage().contains("Session not found")
118+
|| e.getMessage().contains("Session was concurrently deleted"))) {
118119
break;
119120
} else {
120121
throw e;

0 commit comments

Comments
 (0)