mirror of
https://github.com/apple/swift-nio
synced 2026-11-26 04:57:49 +00:00
Replace Task.sleep(for:) with Task.sleep(nanoseconds:) in `EventL… (#3548)
…oopTest` ### Motivation * `Task.sleep(for:)` and the `Duration` literals (`.milliseconds`, `.seconds`) require iOS 16.0+, tvOS 16.0+, and watchOS 9.0+, so these calls cause build failures on simulator test destinations in CI. ### Modifications * Replaced all five `Task.sleep(for:)` calls in `EventLoopTest.swift` with the universally available `Task.sleep(nanoseconds:)`. ### Result * `EventLoopTest` compiles for iOS, tvOS, and watchOS simulator destinations. Verified locally with `xcodebuild build-for-testing`.
This commit is contained in:
1 parent
e7a0c5264f
commit
daec044c3f
1 file changed
+5
-5
@@ -934,7 +934,7 @@ final class MultiThreadedEventLoopGroupTests {
|
||||
task.cancel(promise: promise2)
|
||||
}
|
||||
|
||||
try await Task.sleep(for: .milliseconds(100))
|
||||
try await Task.sleep(nanoseconds: 100_000_000)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -968,7 +968,7 @@ final class MultiThreadedEventLoopGroupTests {
|
||||
confirm()
|
||||
}
|
||||
}
|
||||
try await Task.sleep(for: .milliseconds(100))
|
||||
try await Task.sleep(nanoseconds: 100_000_000)
|
||||
}
|
||||
let cancellationHandle = try #require(task)
|
||||
|
||||
@@ -976,7 +976,7 @@ final class MultiThreadedEventLoopGroupTests {
|
||||
promise1.futureResult.whenSuccess { confirmation() }
|
||||
promise2.futureResult.whenSuccess { confirmation() }
|
||||
cancellationHandle.cancel(promise: promise2)
|
||||
try await Task.sleep(for: .seconds(1))
|
||||
try await Task.sleep(nanoseconds: 1_000_000_000)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1013,7 +1013,7 @@ final class MultiThreadedEventLoopGroupTests {
|
||||
}
|
||||
|
||||
// Allow 0.5 seconds for promises to incorrectly fulfill
|
||||
try await Task.sleep(for: .milliseconds(500))
|
||||
try await Task.sleep(nanoseconds: 500_000_000)
|
||||
}
|
||||
|
||||
// Phase 2 — now allow completion and verify they DO complete
|
||||
@@ -1029,7 +1029,7 @@ final class MultiThreadedEventLoopGroupTests {
|
||||
}
|
||||
|
||||
// Allow 0.5 seconds for promises to correctly fulfill
|
||||
try await Task.sleep(for: .milliseconds(500))
|
||||
try await Task.sleep(nanoseconds: 500_000_000)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user