diff --git a/Tests/OpenAPIURLSessionTests/URLSessionBidirectionalStreamingTests/HTTPBodyOutputStreamTests.swift b/Tests/OpenAPIURLSessionTests/URLSessionBidirectionalStreamingTests/HTTPBodyOutputStreamTests.swift index b173ec0..fbc3258 100644 --- a/Tests/OpenAPIURLSessionTests/URLSessionBidirectionalStreamingTests/HTTPBodyOutputStreamTests.swift +++ b/Tests/OpenAPIURLSessionTests/URLSessionBidirectionalStreamingTests/HTTPBodyOutputStreamTests.swift @@ -60,10 +60,12 @@ class HTTPBodyOutputStreamBridgeTests: XCTestCase { XCTAssertNil(inputStream.streamError) // Check the output stream closes gracefully in response to the input stream closing. - HTTPBodyOutputStreamBridge.streamQueue.asyncAndWait { - XCTAssertEqual(requestStream.outputStream.streamStatus, .closed) - XCTAssertNil(requestStream.outputStream.streamError) - } + HTTPBodyOutputStreamBridge.streamQueue.asyncAndWait( + execute: DispatchWorkItem { + XCTAssertEqual(requestStream.outputStream.streamStatus, .closed) + XCTAssertNil(requestStream.outputStream.streamError) + } + ) } func testHTTPBodyOutputStreamBridgeBackpressure() async throws { diff --git a/Tests/OpenAPIURLSessionTests/URLSessionBidirectionalStreamingTests/URLSessionBidirectionalStreamingTests.swift b/Tests/OpenAPIURLSessionTests/URLSessionBidirectionalStreamingTests/URLSessionBidirectionalStreamingTests.swift index f4fd6fd..bb604a2 100644 --- a/Tests/OpenAPIURLSessionTests/URLSessionBidirectionalStreamingTests/URLSessionBidirectionalStreamingTests.swift +++ b/Tests/OpenAPIURLSessionTests/URLSessionBidirectionalStreamingTests/URLSessionBidirectionalStreamingTests.swift @@ -305,7 +305,7 @@ class URLSessionBidirectionalStreamingTests: XCTestCase { // Just count the bytes received and verify the total matches what the server sent. case count // Add some artificial delay to simulate business logic to show how the backpressure mechanism works (or not). - case delay(Duration) + case delay(TimeAmount) } func testStreamingDownload( @@ -387,7 +387,7 @@ class URLSessionBidirectionalStreamingTests: XCTestCase { for try await receivedResponseChunk in responseBody! { print("Client received some response body bytes (numBytes: \(receivedResponseChunk.count))") print("Client doing fake work for \(delay)s") - try await Task.sleep(for: delay) + try await Task.sleep(nanoseconds: UInt64(delay.nanoseconds)) } }