@@ -23,7 +23,7 @@ import XCTest
23
23
24
24
class URLSessionBidirectionalStreamingTests : XCTestCase {
25
25
// swift-format-ignore: AllPublicDeclarationsHaveDocumentation
26
- static override func setUp( ) { OpenAPIURLSession . debugLoggingEnabled = true }
26
+ static override func setUp( ) { OpenAPIURLSession . debugLoggingEnabled = false }
27
27
28
28
func testBidirectionalEcho_PerChunkRatchet_1BChunk_1Chunks_1BUploadBuffer_1BDownloadWatermark( ) async throws {
29
29
try await testBidirectionalEchoPerChunkRatchet (
@@ -329,31 +329,31 @@ class URLSessionBidirectionalStreamingTests: XCTestCase {
329
329
)
330
330
)
331
331
)
332
- print ( " Server sent response head " )
332
+ debug ( " Server sent response head " )
333
333
for i in 1 ... numResponseChunks {
334
334
try await outbound. write ( . body( ByteBuffer ( bytes: responseChunk) ) )
335
- print ( " Server sent body chunk \( i) / \( numResponseChunks) of \( responseChunk. count) " )
335
+ debug ( " Server sent body chunk \( i) / \( numResponseChunks) of \( responseChunk. count) " )
336
336
}
337
337
case . body: preconditionFailure ( )
338
338
case . end:
339
339
try await outbound. write ( . end( nil ) )
340
- print ( " Server sent response end " )
340
+ debug ( " Server sent response end " )
341
341
}
342
342
}
343
343
}
344
344
}
345
- print ( " Server running on 127.0.0.1: \( serverPort) " )
345
+ debug ( " Server running on 127.0.0.1: \( serverPort) " )
346
346
347
347
// Send the request.
348
- print ( " Client starting request " )
348
+ debug ( " Client starting request " )
349
349
let ( response, responseBody) = try await URLSession . shared. bidirectionalStreamingRequest (
350
350
for: HTTPRequest ( method: . get, scheme: nil , authority: nil , path: " / " ) ,
351
351
baseURL: URL ( string: " http://127.0.0.1: \( serverPort) " ) !,
352
352
requestBody: nil ,
353
353
requestStreamBufferSize: 16 * 1024 * 1024 ,
354
354
responseStreamWatermarks: responseStreamWatermarks
355
355
)
356
- print ( " Client received response head: \( response) " )
356
+ debug ( " Client received response head: \( response) " )
357
357
XCTAssertEqual ( response. status, . ok)
358
358
359
359
switch verification {
@@ -362,10 +362,10 @@ class URLSessionBidirectionalStreamingTests: XCTestCase {
362
362
var unprocessedBytes = ByteBuffer ( )
363
363
var numProcessedChunks = 0
364
364
for try await receivedResponseChunk in responseBody! {
365
- print ( " Client received some response body bytes (numBytes: \( receivedResponseChunk. count) ) " )
365
+ debug ( " Client received some response body bytes (numBytes: \( receivedResponseChunk. count) ) " )
366
366
unprocessedBytes. writeBytes ( receivedResponseChunk)
367
367
while unprocessedBytes. readableBytes >= responseChunk. count {
368
- print ( " Client reconstructing and verifying chunk \( numProcessedChunks+ 1 ) / \( numResponseChunks) " )
368
+ debug ( " Client reconstructing and verifying chunk \( numProcessedChunks+ 1 ) / \( numResponseChunks) " )
369
369
XCTAssertEqual (
370
370
ArraySlice ( unprocessedBytes. readBytes ( length: responseChunk. count) !) ,
371
371
responseChunk
@@ -379,14 +379,14 @@ class URLSessionBidirectionalStreamingTests: XCTestCase {
379
379
case . count:
380
380
var numBytesReceived = 0
381
381
for try await receivedResponseChunk in responseBody! {
382
- print ( " Client received some response body bytes (numBytes: \( receivedResponseChunk. count) ) " )
382
+ debug ( " Client received some response body bytes (numBytes: \( receivedResponseChunk. count) ) " )
383
383
numBytesReceived += receivedResponseChunk. count
384
384
}
385
385
XCTAssertEqual ( numBytesReceived, responseChunk. count * numResponseChunks)
386
386
case . delay( let delay) :
387
387
for try await receivedResponseChunk in responseBody! {
388
- print ( " Client received some response body bytes (numBytes: \( receivedResponseChunk. count) ) " )
389
- print ( " Client doing fake work for \( delay) s " )
388
+ debug ( " Client received some response body bytes (numBytes: \( receivedResponseChunk. count) ) " )
389
+ debug ( " Client doing fake work for \( delay) s " )
390
390
try await Task . sleep ( nanoseconds: UInt64 ( delay. nanoseconds) )
391
391
}
392
392
}
0 commit comments