File tree Expand file tree Collapse file tree 1 file changed +12
-3
lines changed
Tests/AsyncDNSResolverTests/c-ares Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ final class CAresDNSResolverTests: XCTestCase {
29
29
options. servers = servers
30
30
31
31
self . resolver = try ! CAresDNSResolver ( options: options)
32
- self . verbose = ProcessInfo . processInfo . environment [ " VERBOSE_TESTS " ] == " true "
32
+ self . verbose = true // TODO: Undo this before merging!!!
33
33
}
34
34
35
35
override func tearDown( ) {
@@ -122,11 +122,19 @@ final class CAresDNSResolverTests: XCTestCase {
122
122
}
123
123
124
124
func test_concurrency( ) async throws {
125
+ let verbose = self . verbose
126
+
125
127
func run(
126
128
_ name: String ,
127
129
times: Int = 100 ,
128
130
_ query: @Sendable @escaping ( _ index: Int ) async throws -> Void
129
131
) async throws {
132
+ let start = Date . now
133
+ defer {
134
+ if verbose {
135
+ print ( " Test of \( name) took \( Int64 ( start. timeIntervalSinceNow * - 1000 ) ) ms. " )
136
+ }
137
+ }
130
138
do {
131
139
try await withThrowingTaskGroup ( of: Void . self) { group in
132
140
for i in 1 ... times {
@@ -137,13 +145,14 @@ final class CAresDNSResolverTests: XCTestCase {
137
145
for try await _ in group { }
138
146
}
139
147
} catch {
140
- print ( " Test of \( name) is throwing an error. " )
148
+ if verbose {
149
+ print ( " Test of \( name) is throwing an error. " )
150
+ }
141
151
throw error
142
152
}
143
153
}
144
154
145
155
let resolver = self . resolver!
146
- let verbose = self . verbose
147
156
try await run ( " queryA " ) { i in
148
157
let reply = try await resolver. queryA ( name: " apple.com " )
149
158
if verbose {
You can’t perform that action at this time.
0 commit comments