From 7ba045dc7d8789f900fc3cbf037bcff358380e25 Mon Sep 17 00:00:00 2001 From: Rick Newton-Rogers Date: Fri, 6 Mar 2026 09:38:25 +0000 Subject: [PATCH] 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. --- Tests/NIOPosixTests/NIOScheduledCallbackTests.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Tests/NIOPosixTests/NIOScheduledCallbackTests.swift b/Tests/NIOPosixTests/NIOScheduledCallbackTests.swift index 4caa11f62..0a97beba0 100644 --- a/Tests/NIOPosixTests/NIOScheduledCallbackTests.swift +++ b/Tests/NIOPosixTests/NIOScheduledCallbackTests.swift @@ -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) }