Skip to content

Commit b50e2fe

Browse files
committed
Fix flaky Network.framework testConnectionFailError test
we may recieve a posix `ECONNREFUSED` too
1 parent 794dc9d commit b50e2fe

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

Tests/AsyncHTTPClientTests/HTTPClientNIOTSTests.swift

+7-1
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,13 @@ class HTTPClientNIOTSTests: XCTestCase {
117117
XCTAssertNoThrow(try httpBin.shutdown())
118118

119119
XCTAssertThrowsError(try httpClient.get(url: "http://localhost:\(port)/get").wait()) {
120-
XCTAssertEqual($0 as? HTTPClientError, .connectTimeout)
120+
if let httpClientError = $0 as? HTTPClientError {
121+
XCTAssertEqual(httpClientError, .connectTimeout)
122+
} else if let posixError = $0 as? HTTPClient.NWPOSIXError {
123+
XCTAssertEqual(posixError.errorCode, .ECONNREFUSED)
124+
} else {
125+
XCTFail("unexpected error \($0)")
126+
}
121127
}
122128
}
123129

0 commit comments

Comments
 (0)