@@ -160,15 +160,17 @@ final class ServerSelectionTests: MongoSwiftTestCase {
160160 }
161161 }
162162
163- func testSelectionWithinLatencyWindow( ) throws {
163+ #if compiler(>=5.5.2) && canImport(_Concurrency)
164+ @available ( macOS 10 . 15 . 0 , * )
165+ func testSelectionWithinLatencyWindow( ) async throws {
164166 let tests = try retrieveSpecTestFiles (
165167 specName: " server-selection " ,
166168 subdirectory: " in_window " ,
167169 asType: SelectionWithinLatencyWindowTest . self
168170 )
169171 for (filename, test) in tests {
170172 print ( " Running test from \( filename) ... " )
171- try self . withTestClient { client in
173+ try await self . withTestClient { client in
172174 var selectedServerCounts : [ ServerAddress : Int ] = [ : ]
173175 let readPreference = ReadPreference . nearest
174176 for _ in 1 ... test. iterations {
@@ -177,7 +179,7 @@ final class ServerSelectionTests: MongoSwiftTestCase {
177179 let servers = test. mockedTopologyState. reduce ( into: [ ServerAddress: Server] ( ) ) {
178180 $0 [ $1. address] = Server ( address: $1. address, operationCount: $1. operationCount)
179181 }
180- let selectedServer = try client. selectServer (
182+ let selectedServer = try await client. selectServer (
181183 readPreference: readPreference,
182184 topology: test. topologyDescription,
183185 servers: servers
@@ -209,6 +211,7 @@ final class ServerSelectionTests: MongoSwiftTestCase {
209211 }
210212 }
211213 }
214+ #endif
212215
213216 func testReadPreferenceValidation( ) throws {
214217 var readPreference = ReadPreference . primary
0 commit comments