mirror of
https://github.com/swift-server/swift-service-lifecycle
synced 2026-11-22 04:30:45 +00:00
Fix flaky testRun_whenServiceThrows_andShutdownGracefully (#260)
## Motivation [`testRun_whenServiceThrows_andShutdownGracefully`](https://github.com/swift-server/swift-service-lifecycle/blob/5e3b0e9/Tests/ServiceLifecycleTests/ServiceGroupTests.swift#L433-L441) is flaky. It failed on the Swift 6.3 Linux job: https://github.com/swift-server/swift-service-lifecycle/actions/runs/35197849503/job/105125249343 After service3 exits, the test pings service1 and expects `.runPing` before `.shutdownGracefully`. But the service group sends the graceful shutdown to service1 as soon as service3 exits, so the two events can arrive in either order. ## Modifications Wait for `.shutdownGracefully` on service1 before pinging it, like `testRun_whenServiceThrows_andShutdownGracefully_andOtherServiceThrows` already does. ## Result The test no longer depends on the order of the two events. `ServiceGroupTests` pass locally with Swift 6.3, and `swift format lint --strict` passes.
This commit is contained in:
1 parent
5e3b0e9a1e
commit
c55297914e
1 file changed
-4
@@ -433,10 +433,6 @@ final class ServiceGroupTests: XCTestCase {
|
||||
// Let's exit from the last service
|
||||
await service3.resumeRunContinuation(with: .success(()))
|
||||
|
||||
// Waiting to see that the remaining is still running
|
||||
service1.sendPing()
|
||||
await XCTAsyncAssertEqual(await eventIterator1.next(), .runPing)
|
||||
|
||||
// The first service should now receive the signal
|
||||
await XCTAsyncAssertEqual(await eventIterator1.next(), .shutdownGracefully)
|
||||
|
||||
|
||||
Reference in new issue
Block a user