Skip to content

Commit 3ad3dc6

Browse files
committed
review fix
1 parent 80c96e2 commit 3ad3dc6

File tree

4 files changed

+13
-19
lines changed

4 files changed

+13
-19
lines changed

Tests/AsyncHTTPClientTests/HTTPClientInternalTests+XCTest.swift

+1
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ extension HTTPClientInternalTests {
4141
("testUncleanCloseThrows", testUncleanCloseThrows),
4242
("testUploadStreamingIsCalledOnTaskEL", testUploadStreamingIsCalledOnTaskEL),
4343
("testWeCanActuallyExactlySetTheEventLoops", testWeCanActuallyExactlySetTheEventLoops),
44+
("testTaskPromiseBoundToEL", testTaskPromiseBoundToEL),
4445
]
4546
}
4647
}

Tests/AsyncHTTPClientTests/HTTPClientInternalTests.swift

+12
Original file line numberDiff line numberDiff line change
@@ -891,4 +891,16 @@ class HTTPClientInternalTests: XCTestCase {
891891
XCTAssert(el1 === response.eventLoop)
892892
XCTAssertNoThrow(try response.wait())
893893
}
894+
895+
func testTaskPromiseBoundToEL() throws {
896+
let elg = getDefaultEventLoopGroup(numberOfThreads: 2)
897+
let el = elg.next()
898+
899+
defer {
900+
XCTAssertNoThrow(try elg.syncShutdownGracefully())
901+
}
902+
903+
let task: Task<HTTPClient.Response> = .init(eventLoop: el, logger: HTTPClient.loggingDisabled)
904+
XCTAssertTrue(task.futureResult.eventLoop === el)
905+
}
894906
}

Tests/AsyncHTTPClientTests/HTTPClientTests+XCTest.swift

-1
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,6 @@ extension HTTPClientTests {
109109
("testNothingIsLoggedAtInfoOrHigher", testNothingIsLoggedAtInfoOrHigher),
110110
("testAllMethodsLog", testAllMethodsLog),
111111
("testClosingIdleConnectionsInPoolLogsInTheBackground", testClosingIdleConnectionsInPoolLogsInTheBackground),
112-
("testTaskPromiseBoundToEL", testTaskPromiseBoundToEL),
113112
]
114113
}
115114
}

Tests/AsyncHTTPClientTests/HTTPClientTests.swift

-18
Original file line numberDiff line numberDiff line change
@@ -2005,22 +2005,4 @@ class HTTPClientTests: XCTestCase {
20052005

20062006
self.defaultClient = nil // so it doesn't get shut down again.
20072007
}
2008-
2009-
func testTaskPromiseBoundToEL() throws {
2010-
let elg = getDefaultEventLoopGroup(numberOfThreads: 2)
2011-
let el = elg.next()
2012-
2013-
let client = HTTPClient(eventLoopGroupProvider: .shared(elg))
2014-
2015-
defer {
2016-
XCTAssertNoThrow(try client.syncShutdown())
2017-
XCTAssertNoThrow(try elg.syncShutdownGracefully())
2018-
}
2019-
2020-
let request = try HTTPClient.Request(url: self.defaultHTTPBinURLPrefix + "/get")
2021-
let delegate = ResponseAccumulator(request: request)
2022-
let task = client.execute(request: request, delegate: delegate, eventLoop: .delegate(on: el))
2023-
XCTAssertTrue(task.futureResult.eventLoop === el)
2024-
XCTAssertNoThrow(try task.wait())
2025-
}
20262008
}

0 commit comments

Comments
 (0)