diff --git a/Tests/TestingTests/Traits/TimeLimitTraitTests.swift b/Tests/TestingTests/Traits/TimeLimitTraitTests.swift index 00c9cbb44..b29ccb93c 100644 --- a/Tests/TestingTests/Traits/TimeLimitTraitTests.swift +++ b/Tests/TestingTests/Traits/TimeLimitTraitTests.swift @@ -184,13 +184,17 @@ struct TimeLimitTraitTests { await withTaskGroup(of: Void.self) { taskGroup in taskGroup.addTask { await Test { - try await Test.Clock.sleep(for: .seconds(60)) + try await Test.Clock.sleep(for: .seconds(60) * 60) }.run() } taskGroup.cancelAll() } } - #expect(timeAwaited < .seconds(5)) // less than the 60 second sleep + + // Expect that the time awaited is significantly less than the duration of + // the sleep above. To avoid flakiness in CI, allow for a somewhat long + // wait, but still much less than the full sleep duration. + #expect(timeAwaited < .seconds(60)) } @available(_clockAPI, *)