Skip to content

Commit a3a69e7

Browse files
olavloitesurbhigarg92
authored andcommitted
test: unflake RetryOnInvalidatedSessionTest (googleapis#3561)
1 parent 178ad02 commit a3a69e7

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ public static void stopServer() throws InterruptedException {
207207
public void setUp() throws InterruptedException {
208208
mockSpanner.reset();
209209
if (spanner == null
210-
|| spanner.getOptions().getSessionPoolOptions().isFailIfPoolExhausted()
210+
|| spanner.getOptions().getSessionPoolOptions().isFailIfSessionNotFound()
211211
!= failOnInvalidatedSession) {
212212
if (spanner != null) {
213213
spanner.close();
@@ -228,8 +228,8 @@ public void setUp() throws InterruptedException {
228228
.build()
229229
.getService();
230230
client = spanner.getDatabaseClient(DatabaseId.of("[PROJECT]", "[INSTANCE]", "[DATABASE]"));
231-
invalidateSessionPool(client, spanner.getOptions().getSessionPoolOptions().getMinSessions());
232231
}
232+
invalidateSessionPool(client, spanner.getOptions().getSessionPoolOptions().getMinSessions());
233233
}
234234

235235
private static void invalidateSessionPool(DatabaseClient client, int minSessions)
@@ -1002,6 +1002,7 @@ public void transactionManagerBatchUpdate() throws InterruptedException {
10021002
} catch (AbortedException e) {
10031003
transaction = assertThrowsSessionNotFoundIfShouldFail(() -> manager.resetForRetry());
10041004
if (transaction == null) {
1005+
manager.close();
10051006
break;
10061007
}
10071008
}

0 commit comments

Comments
 (0)