Files
swift-nio/Tests
Cory Benfield 97c3f28ad0 Fix flakiness in testWithConfiguredStreamSocket (#3399)
Motivation:

This test occasionally fails in our ongoing continuous CI solution.
Flaky tests are bad, and we should aim not to have them, so let's fix
it.

My diagnosis of the most likely race here (which leads to
`alreadyClosed`) being thrown _somewhere_ from this code is that the
client channel got closed unexpectedly. This would happen if an unusual
series of events occurs:

1. The client connection succeeds and the channel starts up
2. The server close then goes through and the server channel is closed
_before_ it actually accepts the connection.
3. This causes the client connection to be reset.
4. The client channel observes this and handles that close.
5. We then close the client from the outside.

Modifications:

Add a ConditionLock we can use to wait for a connection to be
established.
Make the use of this ConditionLock resilient to weird test behaviour by
always using timeouts for blocking operations.

Result:

Less flaky tests.
2025-10-06 14:53:44 +01:00
..
2025-10-06 10:58:33 +01:00
2025-10-06 10:58:33 +01:00
2024-07-19 11:48:17 +02:00
2025-10-06 10:58:33 +01:00
2025-05-07 12:24:44 +00:00