diff --git a/.circleci/config.yml b/.circleci/config.yml index 7675de2..f4c08b8 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -67,7 +67,7 @@ jobs: parameters: swift-image: type: string - default: &default-swift-image "swift:5.7" + default: &default-swift-image "swift:5.10" influxdb-image: type: string default: &default-influxdb-image "influxdb:latest" @@ -126,7 +126,7 @@ jobs: parameters: xcode-version: type: string - default: &default-xcode "13.4.1" + default: &default-xcode "15.3.0" influxdb-package-version: type: string default: "2.0.4" @@ -319,19 +319,14 @@ workflows: - check-examples - check-examples-macOS - tests-linux: - name: tests-linux-5.3 - swift-image: "swift:5.3" + name: tests-linux-5.8 + swift-image: "swift:5.8" - tests-linux: - name: tests-linux-5.4 - swift-image: "swift:5.4" + name: tests-linux-5.9 + swift-image: "swift:5.9" - tests-linux: - name: tests-linux-5.5 - swift-image: "swift:5.5" - - tests-linux: - name: tests-linux-5.6 - swift-image: "swift:5.6" - - tests-linux: - name: tests-linux-5.7 + name: tests-linux-5.10 + swift-image: "swift:5.10" - tests-macOS nightly: when: diff --git a/CHANGELOG.md b/CHANGELOG.md index 36f9ee2..a028978 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ ## 1.7.0 [unreleased] +### CI +1. [#55](https://github.com/influxdata/influxdb-client-swift/pull/55): Use Swift 5.8, 5.9 and 5.10 in CI and update XCode to 15.3.0 + ## 1.6.0 [2022-12-01] ### Others diff --git a/Tests/InfluxDBSwiftApisTests/InfluxDB2APITests.swift b/Tests/InfluxDBSwiftApisTests/InfluxDB2APITests.swift index a07a670..7b2a5b5 100644 --- a/Tests/InfluxDBSwiftApisTests/InfluxDB2APITests.swift +++ b/Tests/InfluxDBSwiftApisTests/InfluxDB2APITests.swift @@ -19,6 +19,12 @@ final class InfluxDB2APITests: XCTestCase { } } + override func tearDownWithError() throws { + if let client = client { + client.close() + } + } + func testCreateInstance() { let api = InfluxDB2API(client: client!) XCTAssertNotNil(api) @@ -79,13 +85,13 @@ class APIXCTestCase: XCTestCase { XCTFail("Request is not defined!") } - let expectation = self.expectation(description: "Success response from API doesn't arrive") + let expectation = XCTestExpectation(description: "Success response from API doesn't arrive") if let request = request { request(nil, nil, checkResponse(check: checker, expectation: expectation)) } - waitForExpectations(timeout: 5, handler: nil) + wait(for: [expectation], timeout: 5) } func checkPost(_ request: ((BodyType, @@ -100,13 +106,13 @@ class APIXCTestCase: XCTestCase { return } - let expectation = self.expectation(description: "Success response from API doesn't arrive") + let expectation = XCTestExpectation(description: "Success response from API doesn't arrive") if let request = request { request(body, nil, checkResponse(check: checker, expectation: expectation)) } - waitForExpectations(timeout: 5, handler: nil) + wait(for: [expectation], timeout: 5) } func checkPost(_ request: ((BodyType, @@ -122,13 +128,13 @@ class APIXCTestCase: XCTestCase { return } - let expectation = self.expectation(description: "Success response from API doesn't arrive") + let expectation = XCTestExpectation(description: "Success response from API doesn't arrive") if let request = request { request(body, nil, nil, checkResponse(check: checker, expectation: expectation)) } - waitForExpectations(timeout: 5, handler: nil) + wait(for: [expectation], timeout: 5) } private func checkResponse(check: @escaping (ResponseType) -> Void, @@ -153,7 +159,7 @@ class APIXCTestCase: XCTestCase { guard Self.orgID.isEmpty else { return } - let expectation = self.expectation(description: "Cannot find my-org") + let expectation = XCTestExpectation(description: "Cannot find my-org") api.organizationsAPI.getOrgs(limit: 100) { organizations, error in if let error = error { XCTFail("\(error)") @@ -165,14 +171,14 @@ class APIXCTestCase: XCTestCase { expectation.fulfill() } } - waitForExpectations(timeout: 5, handler: nil) + wait(for: [expectation], timeout: 5) } private func findMyBucket() { guard Self.bucketID.isEmpty else { return } - let expectation = self.expectation(description: "Cannot find my-bucket") + let expectation = XCTestExpectation(description: "Cannot find my-bucket") api.bucketsAPI.getBuckets(limit: 100) { response, error in if let error = error { XCTFail("\(error)") @@ -184,7 +190,7 @@ class APIXCTestCase: XCTestCase { expectation.fulfill() } } - waitForExpectations(timeout: 5, handler: nil) + wait(for: [expectation], timeout: 5) } } diff --git a/Tests/InfluxDBSwiftApisTests/PingAPITests.swift b/Tests/InfluxDBSwiftApisTests/PingAPITests.swift index 7004c27..64191ec 100644 --- a/Tests/InfluxDBSwiftApisTests/PingAPITests.swift +++ b/Tests/InfluxDBSwiftApisTests/PingAPITests.swift @@ -8,7 +8,7 @@ import XCTest final class PingAPITests: APIXCTestCase { func testPing() { - let expectation = self.expectation(description: "Success response from API doesn't arrive") + let expectation = XCTestExpectation(description: "Success response from API doesn't arrive") api.pingAPI.getPing { headers, error -> Void in if let error = error { @@ -23,7 +23,7 @@ final class PingAPITests: APIXCTestCase { expectation.fulfill() } - waitForExpectations(timeout: 5, handler: nil) + wait(for: [expectation], timeout: 5) } #if swift(>=5.5) diff --git a/Tests/InfluxDBSwiftApisTests/SecretsAPITests.swift b/Tests/InfluxDBSwiftApisTests/SecretsAPITests.swift index b188e90..c38abdf 100644 --- a/Tests/InfluxDBSwiftApisTests/SecretsAPITests.swift +++ b/Tests/InfluxDBSwiftApisTests/SecretsAPITests.swift @@ -25,7 +25,7 @@ class SecretsAPITests: APIXCTestCase { func testCreateSecret() { let request = [generateName("secret"): generateName("secret")] - let expectation = self.expectation(description: "Success response from API doesn't arrive") + let expectation = XCTestExpectation(description: "Success response from API doesn't arrive") self.api.secretsAPI.patchOrgsIDSecrets(orgID: Self.orgID, requestBody: request) { _, error in if let error = error { @@ -35,6 +35,6 @@ class SecretsAPITests: APIXCTestCase { expectation.fulfill() } - waitForExpectations(timeout: 5, handler: nil) + wait(for: [expectation], timeout: 5) } } diff --git a/Tests/InfluxDBSwiftTests/DeleteAPITests.swift b/Tests/InfluxDBSwiftTests/DeleteAPITests.swift index 46d474d..ef8b379 100644 --- a/Tests/InfluxDBSwiftTests/DeleteAPITests.swift +++ b/Tests/InfluxDBSwiftTests/DeleteAPITests.swift @@ -30,7 +30,7 @@ final class DeleteAPITests: XCTestCase { } func testBucketOrgParameters() { - let expectation = self.expectation(description: "Success response from API doesn't arrive") + let expectation = XCTestExpectation(description: "Success response from API doesn't arrive") expectation.expectedFulfillmentCount = 2 MockURLProtocol.handler = { request, _ in @@ -53,11 +53,11 @@ final class DeleteAPITests: XCTestCase { expectation.fulfill() } - waitForExpectations(timeout: 1, handler: nil) + wait(for: [expectation], timeout: 1) } func testBucketIDOrgIDParameters() { - let expectation = self.expectation(description: "Success response from API doesn't arrive") + let expectation = XCTestExpectation(description: "Success response from API doesn't arrive") expectation.expectedFulfillmentCount = 2 MockURLProtocol.handler = { request, _ in @@ -80,11 +80,11 @@ final class DeleteAPITests: XCTestCase { expectation.fulfill() } - waitForExpectations(timeout: 1, handler: nil) + wait(for: [expectation], timeout: 1) } func testWithoutBucketOrgParameters() { - let expectation = self.expectation(description: "Success response from API doesn't arrive") + let expectation = XCTestExpectation(description: "Success response from API doesn't arrive") expectation.expectedFulfillmentCount = 2 MockURLProtocol.handler = { request, _ in @@ -106,11 +106,11 @@ final class DeleteAPITests: XCTestCase { expectation.fulfill() } - waitForExpectations(timeout: 1, handler: nil) + wait(for: [expectation], timeout: 1) } func testPredicateRequestSerialization() { - let expectation = self.expectation(description: "Success response from API doesn't arrive") + let expectation = XCTestExpectation(description: "Success response from API doesn't arrive") expectation.expectedFulfillmentCount = 2 MockURLProtocol.handler = { _, bodyData in @@ -140,11 +140,11 @@ final class DeleteAPITests: XCTestCase { expectation.fulfill() } - waitForExpectations(timeout: 1, handler: nil) + wait(for: [expectation], timeout: 1) } func testErrorResponse() { - let expectation = self.expectation(description: "Success response from API doesn't arrive") + let expectation = XCTestExpectation(description: "Success response from API doesn't arrive") expectation.expectedFulfillmentCount = 2 MockURLProtocol.handler = { request, _ in @@ -165,12 +165,12 @@ final class DeleteAPITests: XCTestCase { expectation.fulfill() } - waitForExpectations(timeout: 1, handler: nil) + wait(for: [expectation], timeout: 1) } #if swift(>=5.5) func testDeleteAsync() async throws { - let expectation = self.expectation(description: "Success response from API doesn't arrive") + let expectation = XCTestExpectation(description: "Success response from API doesn't arrive") expectation.expectedFulfillmentCount = 1 MockURLProtocol.handler = { _, _ in @@ -187,7 +187,7 @@ final class DeleteAPITests: XCTestCase { try await client.deleteAPI.delete(predicate: predicate) - await waitForExpectations(timeout: 1, handler: nil) + await wait(for: [expectation], timeout: 1) } #endif } diff --git a/Tests/InfluxDBSwiftTests/InfluxDBClientTests.swift b/Tests/InfluxDBSwiftTests/InfluxDBClientTests.swift index 7365404..5b5f933 100644 --- a/Tests/InfluxDBSwiftTests/InfluxDBClientTests.swift +++ b/Tests/InfluxDBSwiftTests/InfluxDBClientTests.swift @@ -100,7 +100,7 @@ final class InfluxDBClientTests: XCTestCase { options: InfluxDBClient.InfluxDBOptions(bucket: "my-bucket", org: "my-org"), protocolClasses: [MockURLProtocol.self]) - let expectation = self.expectation(description: "Success response from API doesn't arrive") + let expectation = XCTestExpectation(description: "Success response from API doesn't arrive") expectation.expectedFulfillmentCount = 3 MockURLProtocol.handler = { request, _ in @@ -126,12 +126,13 @@ final class InfluxDBClientTests: XCTestCase { expectation.fulfill() } - waitForExpectations(timeout: 1, handler: nil) + wait(for: [expectation], timeout: 1) } func testDisableRedirect() { - let expectation = self.expectation(description: "Redirect response from API doesn't arrive") + let expectation = XCTestExpectation(description: "Redirect response from API doesn't arrive") expectation.expectedFulfillmentCount = 2 + expectation.assertForOverFulfill = false class DisableRedirect: NSObject, URLSessionTaskDelegate { let expectation: XCTestExpectation @@ -174,12 +175,13 @@ final class InfluxDBClientTests: XCTestCase { client.queryAPI.query(query: "from ...") { _, _ in } - waitForExpectations(timeout: 1, handler: nil) + wait(for: [expectation], timeout: 1) } func testHTTPLogging() { TestLogHandler.content = "" - let expectation = self.expectation(description: "Success response from API doesn't arrive") + let expectation = XCTestExpectation(description: "Success response from API doesn't arrive") + expectation.assertForOverFulfill = false LoggingSystem.bootstrap(TestLogHandler.init) client = InfluxDBClient(url: Self.dbURL(), token: "my-token", debugging: true) @@ -199,7 +201,7 @@ final class InfluxDBClientTests: XCTestCase { expectation.fulfill() } - waitForExpectations(timeout: 1, handler: nil) + wait(for: [expectation], timeout: 5) XCTAssertTrue(TestLogHandler.content.contains("Authorization: ***"), TestLogHandler.content) } diff --git a/Tests/InfluxDBSwiftTests/IntegrationTests.swift b/Tests/InfluxDBSwiftTests/IntegrationTests.swift index 37658d2..a318791 100644 --- a/Tests/InfluxDBSwiftTests/IntegrationTests.swift +++ b/Tests/InfluxDBSwiftTests/IntegrationTests.swift @@ -33,7 +33,7 @@ final class IntegrationTests: XCTestCase { } func testQueryWriteIntegration() { - var expectation = self.expectation(description: "Success response from API doesn't arrive") + var expectation = XCTestExpectation(description: "Success response from API doesn't arrive") let measurement = "h2o_\(Date().timeIntervalSince1970)" @@ -52,8 +52,8 @@ final class IntegrationTests: XCTestCase { expectation.fulfill() } - waitForExpectations(timeout: 5, handler: nil) - expectation = self.expectation(description: "Success response from API doesn't arrive") + wait(for: [expectation], timeout: 5) + expectation = XCTestExpectation(description: "Success response from API doesn't arrive") let query = """ from(bucket: "my-bucket") @@ -84,11 +84,11 @@ final class IntegrationTests: XCTestCase { expectation.fulfill() } - waitForExpectations(timeout: 5, handler: nil) + wait(for: [expectation], timeout: 5) } func testDelete() { - var expectation = self.expectation(description: "Success response from Write API doesn't arrive") + var expectation = XCTestExpectation(description: "Success response from Write API doesn't arrive") let measurement = "h2o_\(Date().timeIntervalSince1970)" @@ -117,8 +117,8 @@ final class IntegrationTests: XCTestCase { expectation.fulfill() } - waitForExpectations(timeout: 5, handler: nil) - expectation = self.expectation(description: "Success response from Query API doesn't arrive") + wait(for: [expectation], timeout: 5) + expectation = XCTestExpectation(description: "Success response from Query API doesn't arrive") let query = """ from(bucket: "my-bucket") @@ -146,9 +146,9 @@ final class IntegrationTests: XCTestCase { expectation.fulfill() } - waitForExpectations(timeout: 5, handler: nil) + wait(for: [expectation], timeout: 5) - expectation = self.expectation(description: "Success response from Delete API doesn't arrive") + expectation = XCTestExpectation(description: "Success response from Delete API doesn't arrive") let predicate = DeletePredicateRequest( start: Date(2019, 10, 5), @@ -162,9 +162,9 @@ final class IntegrationTests: XCTestCase { expectation.fulfill() } - waitForExpectations(timeout: 5, handler: nil) + wait(for: [expectation], timeout: 5) - expectation = self.expectation(description: "Success response from Query API doesn't arrive") + expectation = XCTestExpectation(description: "Success response from Query API doesn't arrive") client.queryAPI.query(query: query) { response, error in if let error = error { @@ -185,6 +185,6 @@ final class IntegrationTests: XCTestCase { expectation.fulfill() } - waitForExpectations(timeout: 5, handler: nil) + wait(for: [expectation], timeout: 5) } } diff --git a/Tests/InfluxDBSwiftTests/QueryAPITests.swift b/Tests/InfluxDBSwiftTests/QueryAPITests.swift index 14838f6..462402d 100644 --- a/Tests/InfluxDBSwiftTests/QueryAPITests.swift +++ b/Tests/InfluxDBSwiftTests/QueryAPITests.swift @@ -30,7 +30,7 @@ final class QueryAPITests: XCTestCase { } func testQuery() { - let expectation = self.expectation(description: "Success response from API doesn't arrive") + let expectation = XCTestExpectation(description: "Success response from API doesn't arrive") expectation.expectedFulfillmentCount = 2 let csv = """ @@ -71,11 +71,11 @@ final class QueryAPITests: XCTestCase { expectation.fulfill() } - waitForExpectations(timeout: 1, handler: nil) + wait(for: [expectation], timeout: 1) } func testParameterizedQuery() { - let expectation = self.expectation(description: "Success response from API doesn't arrive") + let expectation = XCTestExpectation(description: "Success response from API doesn't arrive") expectation.expectedFulfillmentCount = 2 let csv = """ @@ -122,11 +122,11 @@ final class QueryAPITests: XCTestCase { expectation.fulfill() } - waitForExpectations(timeout: 1, handler: nil) + wait(for: [expectation], timeout: 1) } func testQueryRaw() { - let expectation = self.expectation(description: "Success response from API doesn't arrive") + let expectation = XCTestExpectation(description: "Success response from API doesn't arrive") expectation.expectedFulfillmentCount = 2 let csv = """ @@ -177,11 +177,11 @@ final class QueryAPITests: XCTestCase { expectation.fulfill() } - waitForExpectations(timeout: 1, handler: nil) + wait(for: [expectation], timeout: 1) } func testParameterizedQueryRaw() { - let expectation = self.expectation(description: "Success response from API doesn't arrive") + let expectation = XCTestExpectation(description: "Success response from API doesn't arrive") expectation.expectedFulfillmentCount = 2 let csv = """ @@ -237,7 +237,7 @@ final class QueryAPITests: XCTestCase { expectation.fulfill() } - waitForExpectations(timeout: 1, handler: nil) + wait(for: [expectation], timeout: 1) } #if swift(>=5.5) diff --git a/Tests/InfluxDBSwiftTests/WriteAPITests.swift b/Tests/InfluxDBSwiftTests/WriteAPITests.swift index 8d2ab49..4c5e57e 100644 --- a/Tests/InfluxDBSwiftTests/WriteAPITests.swift +++ b/Tests/InfluxDBSwiftTests/WriteAPITests.swift @@ -37,7 +37,7 @@ final class WriteAPITests: XCTestCase { } func testWriteRecord() { - let expectation = self.expectation(description: "Success response from API doesn't arrive") + let expectation = XCTestExpectation(description: "Success response from API doesn't arrive") expectation.expectedFulfillmentCount = 2 MockURLProtocol.handler = simpleWriteHandler(expectation: expectation) @@ -54,11 +54,11 @@ final class WriteAPITests: XCTestCase { expectation.fulfill() } - waitForExpectations(timeout: 1, handler: nil) + wait(for: [expectation], timeout: 1) } func testWritePoint() { - let expectation = self.expectation(description: "Success response from API doesn't arrive") + let expectation = XCTestExpectation(description: "Success response from API doesn't arrive") expectation.expectedFulfillmentCount = 2 MockURLProtocol.handler = simpleWriteHandler(expectation: expectation) @@ -78,11 +78,11 @@ final class WriteAPITests: XCTestCase { expectation.fulfill() } - waitForExpectations(timeout: 1, handler: nil) + wait(for: [expectation], timeout: 1) } func testWritePointsDifferentPrecision() { - let expectation = self.expectation(description: "Success response from API doesn't arrive") + let expectation = XCTestExpectation(description: "Success response from API doesn't arrive") expectation.expectedFulfillmentCount = 2 var requests: [URLRequest] = [] @@ -110,7 +110,7 @@ final class WriteAPITests: XCTestCase { expectation.fulfill() } - waitForExpectations(timeout: 1, handler: nil) + wait(for: [expectation], timeout: 1) XCTAssertEqual(1, requests.count) XCTAssertEqual( @@ -121,7 +121,7 @@ final class WriteAPITests: XCTestCase { } func testWriteArrayOfArray() { - let expectation = self.expectation(description: "Success response from API doesn't arrive") + let expectation = XCTestExpectation(description: "Success response from API doesn't arrive") expectation.expectedFulfillmentCount = 2 MockURLProtocol.handler = { _, bodyData in @@ -153,7 +153,7 @@ final class WriteAPITests: XCTestCase { expectation.fulfill() } - waitForExpectations(timeout: 1, handler: nil) + wait(for: [expectation], timeout: 1) } func testWriteRecordGzip() { @@ -165,7 +165,7 @@ final class WriteAPITests: XCTestCase { options: InfluxDBClient.InfluxDBOptions(bucket: "my-bucket", org: "my-org", enableGzip: true), protocolClasses: [MockURLProtocol.self]) - let expectation = self.expectation(description: "Success response from API doesn't arrive") + let expectation = XCTestExpectation(description: "Success response from API doesn't arrive") expectation.expectedFulfillmentCount = 2 MockURLProtocol.handler = { request, bodyData in @@ -185,11 +185,11 @@ final class WriteAPITests: XCTestCase { expectation.fulfill() } - waitForExpectations(timeout: 1, handler: nil) + wait(for: [expectation], timeout: 1) } func testWriteRecords() { - let expectation = self.expectation(description: "Success response from API doesn't arrive") + let expectation = XCTestExpectation(description: "Success response from API doesn't arrive") expectation.expectedFulfillmentCount = 2 MockURLProtocol.handler = { _, bodyData in @@ -211,11 +211,11 @@ final class WriteAPITests: XCTestCase { expectation.fulfill() } - waitForExpectations(timeout: 1, handler: nil) + wait(for: [expectation], timeout: 1) } func testWriteRecordTypes() { - let expectation = self.expectation(description: "Success response from API doesn't arrive") + let expectation = XCTestExpectation(description: "Success response from API doesn't arrive") expectation.expectedFulfillmentCount = 6 var body: [String] = [] @@ -261,12 +261,12 @@ final class WriteAPITests: XCTestCase { expectation.fulfill() } - waitForExpectations(timeout: 1, handler: nil) + wait(for: [expectation], timeout: 1) XCTAssertEqual(required, body.joined(separator: "\n")) } func testWriteRecordResult() { - let expectation = self.expectation(description: "Success response from API doesn't arrive") + let expectation = XCTestExpectation(description: "Success response from API doesn't arrive") expectation.expectedFulfillmentCount = 2 MockURLProtocol.handler = simpleWriteHandler(expectation: expectation) @@ -282,12 +282,12 @@ final class WriteAPITests: XCTestCase { expectation.fulfill() } - waitForExpectations(timeout: 1, handler: nil) + wait(for: [expectation], timeout: 1) } func testWriteRecordCombine() { #if canImport(Combine) - let expectation = self.expectation(description: "Success response from API doesn't arrive") + let expectation = XCTestExpectation(description: "Success response from API doesn't arrive") expectation.expectedFulfillmentCount = 2 MockURLProtocol.handler = simpleWriteHandler(expectation: expectation) @@ -305,7 +305,7 @@ final class WriteAPITests: XCTestCase { }) .store(in: &bag) - waitForExpectations(timeout: 1, handler: nil) + wait(for: [expectation], timeout: 1) #endif } @@ -316,7 +316,7 @@ final class WriteAPITests: XCTestCase { token: "my-token", protocolClasses: [MockURLProtocol.self]) - let expectation = self.expectation(description: "Check requirements from API") + let expectation = XCTestExpectation(description: "Check requirements from API") expectation.expectedFulfillmentCount = 2 MockURLProtocol.handler = { _, _ in @@ -346,11 +346,11 @@ final class WriteAPITests: XCTestCase { expectation.fulfill() } - waitForExpectations(timeout: 1, handler: nil) + wait(for: [expectation], timeout: 1) } func testUnsuccessfulResponse() { - let expectation = self.expectation(description: "Check requirements from API") + let expectation = XCTestExpectation(description: "Check requirements from API") expectation.expectedFulfillmentCount = 1 MockURLProtocol.handler = { _, _ in @@ -372,11 +372,11 @@ final class WriteAPITests: XCTestCase { expectation.fulfill() } - waitForExpectations(timeout: 1, handler: nil) + wait(for: [expectation], timeout: 1) } func testDefaultTags() { - let expectation = self.expectation(description: "Success response from API doesn't arrive") + let expectation = XCTestExpectation(description: "Success response from API doesn't arrive") expectation.expectedFulfillmentCount = 6 var body: [String] = [] @@ -422,12 +422,12 @@ final class WriteAPITests: XCTestCase { expectation.fulfill() } - waitForExpectations(timeout: 1, handler: nil) + wait(for: [expectation], timeout: 1) XCTAssertEqual(required, body.joined(separator: "\n")) } func testEmptyRecords() { - let expectation = self.expectation(description: "Success response from API doesn't arrive") + let expectation = XCTestExpectation(description: "Success response from API doesn't arrive") MockURLProtocol.handler = { _, _ in XCTFail("unexpected HTTP call") @@ -443,12 +443,12 @@ final class WriteAPITests: XCTestCase { expectation.fulfill() } - waitForExpectations(timeout: 1, handler: nil) + wait(for: [expectation], timeout: 1) } #if swift(>=5.5) func testWriteAsync() async throws { - let expectation = self.expectation(description: "Success response from API doesn't arrive") + let expectation = XCTestExpectation(description: "Success response from API doesn't arrive") expectation.expectedFulfillmentCount = 3 MockURLProtocol.handler = simpleWriteHandler(expectation: expectation) @@ -469,7 +469,7 @@ final class WriteAPITests: XCTestCase { ) try await client.makeWriteAPI().write(tuple: tuple) - await waitForExpectations(timeout: 1, handler: nil) + await wait(for: [expectation], timeout: 1) } #endif