From 0b003efcd9577da6ddeac6d478b810e2e8a1ffce Mon Sep 17 00:00:00 2001 From: Scott Berrevoets Date: Wed, 20 Mar 2024 15:44:10 -0700 Subject: [PATCH] Try increasing timeouts --- Tests/KronosTests/NTPClientTests.swift | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/Tests/KronosTests/NTPClientTests.swift b/Tests/KronosTests/NTPClientTests.swift index 646f5e3..06f19fe 100644 --- a/Tests/KronosTests/NTPClientTests.swift +++ b/Tests/KronosTests/NTPClientTests.swift @@ -9,7 +9,7 @@ final class NTPClientTests: XCTestCase { DNSResolver.resolve(host: "time.apple.com") { addresses in XCTAssertGreaterThan(addresses.count, 0) - NTPClient().query(ip: addresses.first!, version: 3, numberOfSamples: 1) { PDU in + NTPClient().query(ip: addresses.first!, timeout: 20, version: 3, numberOfSamples: 1) { PDU in XCTAssertNotNil(PDU) XCTAssertGreaterThanOrEqual(PDU!.version, 3) @@ -19,7 +19,7 @@ final class NTPClientTests: XCTestCase { } } - self.waitForExpectations(timeout: 10) + self.waitForExpectations(timeout: 20) } func testQueryPool() { @@ -27,7 +27,7 @@ final class NTPClientTests: XCTestCase { NTPClient().query(pool: "0.pool.ntp.org", numberOfSamples: 1, maximumServers: 1) { offset, _, _ in XCTAssertNotNil(offset) - NTPClient().query(pool: "0.pool.ntp.org", numberOfSamples: 1, maximumServers: 1) + NTPClient().query(pool: "0.pool.ntp.org", numberOfSamples: 1, maximumServers: 1, timeout: 20) { offset2, _, _ in XCTAssertNotNil(offset2) XCTAssertLessThan(abs(offset! - offset2!), 0.10) @@ -35,16 +35,17 @@ final class NTPClientTests: XCTestCase { } } - self.waitForExpectations(timeout: 10) + self.waitForExpectations(timeout: 20) } func testQueryPoolWithIPv6() { let expectation = self.expectation(description: "NTPClient queries a pool that supports IPv6") - NTPClient().query(pool: "2.pool.ntp.org", numberOfSamples: 1, maximumServers: 1) { offset, _, _ in + NTPClient().query(pool: "2.pool.ntp.org", numberOfSamples: 1, maximumServers: 1, timeout: 20) + { offset, _, _ in XCTAssertNotNil(offset) expectation.fulfill() } - self.waitForExpectations(timeout: 10) + self.waitForExpectations(timeout: 20) } }