Extend timeout in testShutdownCancelsOutstandingScheduledCallbacks (#3537)

Extend timeout in testShutdownCancelsOutstandingScheduledCallbacks

### Motivation:

* `testShutdownCancelsOutstandingScheduledCallbacks` can be flaky,
  particularly on slower systems like simulated devices in CI.
* In some circumstances the task can be executed before it has chance to
  be cancelled.

### Modifications:

* Schedule the task for the far future so that it is available to be
  cancelled even on slower systems.

### Result:

Less flaky tests.
This commit is contained in:
Rick Newton-Rogers authored and GitHub committed 2026-03-06 09:38:25 +00:00
1 parent acf9bbe0fd
commit 7ba045dc7d
1 file changed
+2 -2
@@ -183,7 +183,7 @@ final class IsolatedEventLoopScheduledCallbackTests: XCTestCase {
func testShutdownCancelsOutstandingScheduledCallbacks() throws {
let handler = NonSendableMockScheduledCallbackHandler()
_ = try self.loop.assumeIsolated().scheduleCallback(in: .milliseconds(1), handler: handler)
_ = try self.loop.assumeIsolated().scheduleCallback(in: .hours(1), handler: handler)
self.shutdownEventLoop()
handler.assert(callbackCount: 0, cancelCount: 1)
}
@@ -336,7 +336,7 @@ extension _BaseScheduledCallbackTests {
func testShutdownCancelsOutstandingScheduledCallbacks() async throws {
let handler = MockScheduledCallbackHandler()
_ = try self.loop.scheduleCallback(in: .milliseconds(1), handler: handler)
_ = try self.loop.scheduleCallback(in: .hours(1), handler: handler)
try await self.shutdownEventLoop()
handler.assert(callbackCount: 0, cancelCount: 1)
}