12
12
//
13
13
//===----------------------------------------------------------------------===//
14
14
15
- #if canImport(Network)
16
-
17
15
@testable import AsyncHTTPClient
16
+ #if canImport(Network)
18
17
import Network
18
+ #endif
19
19
import NIO
20
20
import NIOSSL
21
21
import NIOTransportServices
@@ -40,31 +40,18 @@ class HTTPClientNIOTSTests: XCTestCase {
40
40
defer {
41
41
XCTAssertNoThrow ( try httpClient. syncShutdown ( ) )
42
42
}
43
+ #if canImport(Network)
43
44
if #available( macOS 10 . 14 , iOS 12 . 0 , tvOS 12 . 0 , watchOS 6 . 0 , * ) {
44
45
XCTAssertTrue ( httpClient. eventLoopGroup is NIOTSEventLoopGroup )
45
46
return
46
47
}
48
+ #endif
47
49
XCTAssertTrue ( httpClient. eventLoopGroup is MultiThreadedEventLoopGroup )
48
50
}
49
51
50
- func testDNSFailError( ) {
51
- guard isTestingNIOTS ( ) else { return }
52
- let httpClient = HTTPClient ( eventLoopGroupProvider: . shared( self . clientGroup) )
53
- defer {
54
- XCTAssertNoThrow ( try httpClient. syncShutdown ( requiresCleanClose: true ) )
55
- }
56
-
57
- do {
58
- _ = try httpClient. get ( url: " http://dnsfail/ " ) . wait ( )
59
- XCTFail ( " This should have failed " )
60
- } catch ChannelError . connectTimeout {
61
- } catch {
62
- XCTFail ( " Error should have been ChannelError.connectTimeout not \( error) " )
63
- }
64
- }
65
-
66
52
func testTLSFailError( ) {
67
53
guard isTestingNIOTS ( ) else { return }
54
+ #if canImport(Network)
68
55
let httpBin = HTTPBin ( ssl: true )
69
56
let httpClient = HTTPClient ( eventLoopGroupProvider: . shared( self . clientGroup) )
70
57
defer {
@@ -80,6 +67,7 @@ class HTTPClientNIOTSTests: XCTestCase {
80
67
} catch {
81
68
XCTFail ( " Error should have been NWTLSError not \( type ( of: error) ) " )
82
69
}
70
+ #endif
83
71
}
84
72
85
73
func testConnectionFailError( ) {
@@ -103,6 +91,7 @@ class HTTPClientNIOTSTests: XCTestCase {
103
91
104
92
func testTLSVersionError( ) {
105
93
guard isTestingNIOTS ( ) else { return }
94
+ #if canImport(Network)
106
95
let httpBin = HTTPBin ( ssl: true )
107
96
let httpClient = HTTPClient (
108
97
eventLoopGroupProvider: . shared( self . clientGroup) ,
@@ -121,7 +110,6 @@ class HTTPClientNIOTSTests: XCTestCase {
121
110
} catch {
122
111
XCTFail ( " Error should have been NWTLSError not \( type ( of: error) ) " )
123
112
}
113
+ #endif
124
114
}
125
115
}
126
-
127
- #endif
0 commit comments