Skip to content

Commit

Permalink
test: fix flaky integration test (#45)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
olavloite committed Jan 24, 2020
1 parent c9864e5 commit 0702b20
Showing 1 changed file with 2 additions and 1 deletion.
Expand Up @@ -114,7 +114,8 @@ private void awaitDeleted(Session session) {
Thread.sleep(500L);
} catch (SpannerException e) {
if (e.getErrorCode() == ErrorCode.NOT_FOUND
&& e.getMessage().contains("Session not found")) {
&& (e.getMessage().contains("Session not found")
|| e.getMessage().contains("Session was concurrently deleted"))) {
break;
} else {
throw e;
Expand Down

0 comments on commit 0702b20

Please sign in to comment.