Repository navigation
Commit 96fa0ee
test(spanner): unflake DynamicChannelPoolPrimeSessionTest (#14278)
In
`sessionArrivingAfterFailedClientConstructionNeverBecomesPrimeSession`,
`arrivedBeforeRelease` was sampled immediately after `getDatabaseClient`
timed out from waiting for multiplexed session creation (200ms).
Under thread scheduling contention or high CI load, the asynchronous
`CreateSession` gRPC call dispatched by `SessionClient` could take
longer than 200ms to reach the mock server. As a result,
`arrivedBeforeRelease` sampled 0 instead of 1. When the gate was later
released, the delayed RPC finally arrived at
`mockSpanner.createSession()`, incrementing the count and causing
`assertEquals(arrivedBeforeRelease,
mockSpanner.arrivedCreateSessions.get())` to fail with `AssertionError:
expected:<0> but was:<1>`.
Fix this race condition by explicitly waiting for the in-flight
`CreateSession` RPC to arrive at `mockSpanner` before sampling
`arrivedBeforeRelease` and releasing the gate.1 parent 783b6ac commit 96fa0ee
1 file changed
Lines changed: 1 addition & 0 deletions
File tree
- java-spanner/google-cloud-spanner/src/test/java/com/google/cloud/spanner
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
379 | 379 | | |
380 | 380 | | |
381 | 381 | | |
| 382 | + | |
382 | 383 | | |
383 | 384 | | |
384 | 385 | | |
| |||
0 commit comments