From d2278b69b9a8970cf58c672851e5776795423b4f Mon Sep 17 00:00:00 2001 From: Stuart Montgomery Date: Sun, 16 Mar 2025 22:19:15 -0500 Subject: [PATCH] Adjust a timing-sensitive TimeLimitTrait test to avoid flakiness in CI --- Tests/TestingTests/Traits/TimeLimitTraitTests.swift | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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, *)