Skip to content

Commit 93f21ed

Browse files
fix(spanner): fix flakiness in testCreateSessionDeadlineExceeded (#12944)
The test `testCreateSessionDeadlineExceeded` in `MultiplexedSessionDatabaseClientMockServerTest` was flaky because it used a non-sticky exception for simulated `DEADLINE_EXCEEDED` on `CreateSession`. This exception could be consumed by background session creation tasks before the test could verify it. This change uses `ofStickyException` to ensure the exception persists until explicitly cleared by `mockSpanner.removeAllExecutionTimes()`, making the test robust against concurrent background activity. Fixes: #12890
1 parent 79480e0 commit 93f21ed

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ public void createSpannerInstance() {
105105
public void testCreateSessionDeadlineExceeded() {
106106
// Simulate a problem with the CreateSession RPC making it slow.
107107
mockSpanner.setCreateSessionExecutionTime(
108-
SimulatedExecutionTime.ofException(Status.DEADLINE_EXCEEDED.asRuntimeException()));
108+
SimulatedExecutionTime.ofStickyException(Status.DEADLINE_EXCEEDED.asRuntimeException()));
109109

110110
Spanner testSpanner =
111111
SpannerOptions.newBuilder()

0 commit comments

Comments
 (0)