Skip to content

Commit 55a62fa

Browse files
committed
chore(spanner): test fix
1 parent eb8b8e3 commit 55a62fa

File tree

1 file changed

+22
-8
lines changed

1 file changed

+22
-8
lines changed

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

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -60,20 +60,34 @@ public void clearRequests() {
6060

6161
@Test
6262
public void testAsyncRunner_doesNotReturnCommitTimestampBeforeCommit() {
63-
assumeFalse("Skipping for mux", isMultiplexedSessionsEnabledForRW());
6463
AsyncRunner runner = client().runAsync();
65-
IllegalStateException e =
66-
assertThrows(IllegalStateException.class, () -> runner.getCommitTimestamp());
67-
assertTrue(e.getMessage().contains("runAsync() has not yet been called"));
64+
if (isMultiplexedSessionsEnabledForRW()) {
65+
ExecutionException e =
66+
assertThrows(ExecutionException.class, () -> runner.getCommitTimestamp().get());
67+
Throwable cause = e.getCause();
68+
assertTrue(cause instanceof IllegalStateException);
69+
assertTrue(cause.getMessage().contains("runAsync() has not yet been called"));
70+
} else {
71+
IllegalStateException e =
72+
assertThrows(IllegalStateException.class, () -> runner.getCommitTimestamp());
73+
assertTrue(e.getMessage().contains("runAsync() has not yet been called"));
74+
}
6875
}
6976

7077
@Test
7178
public void testAsyncRunner_doesNotReturnCommitResponseBeforeCommit() {
72-
assumeFalse("Skipping for mux", isMultiplexedSessionsEnabledForRW());
7379
AsyncRunner runner = client().runAsync();
74-
IllegalStateException e =
75-
assertThrows(IllegalStateException.class, () -> runner.getCommitResponse());
76-
assertTrue(e.getMessage().contains("runAsync() has not yet been called"));
80+
if (isMultiplexedSessionsEnabledForRW()) {
81+
ExecutionException e =
82+
assertThrows(ExecutionException.class, () -> runner.getCommitResponse().get());
83+
Throwable cause = e.getCause();
84+
assertTrue(cause instanceof IllegalStateException);
85+
assertTrue(cause.getMessage().contains("runAsync() has not yet been called"));
86+
} else {
87+
IllegalStateException e =
88+
assertThrows(IllegalStateException.class, () -> runner.getCommitResponse());
89+
assertTrue(e.getMessage().contains("runAsync() has not yet been called"));
90+
}
7791
}
7892

7993
@Test

0 commit comments

Comments
 (0)