fix(test): resolve flakiness in MaxIdleConnections tests#825
Conversation
There was a problem hiding this comment.
Code Review
This pull request refactors several Spanner driver tests to handle multiplexed sessions correctly, simplifies connection closing, and introduces a helper function countCreatedSessions to count session creation requests. It also updates DrainRequestsFromServer to safely handle closed channels. The review feedback suggests two improvements: storing the channel in a local variable before the loop in DrainRequestsFromServer to avoid repeated method calls, and using a type switch in countCreatedSessions for more idiomatic Go code.
|
Excellent fix for |
Resolves the flakiness in TestMaxIdleConnectionsNonZero and TestMaxIdleConnectionsZero by running them with multiplexed sessions disabled, configuring minSessions=1, and counting the created sessions. Drains requests after shutting down the client/server during teardown. Additionally, fixes an infinite loop bug in DrainRequestsFromServer on closed channel, and removes an unused background client in setupTestDBConnectionWithParamsAndDialect.
Fixes #816