Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use example.com in single IP test #113

Open
wants to merge 14 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ jobs:
steps:
- uses: actions/checkout@v1
- name: Setup Xcode
run: sudo xcode-select -s /Applications/Xcode_14.3.1.app
run: sudo xcode-select -s /Applications/Xcode_15.2.0.app
- run: make test-${{ matrix.action }}
3 changes: 3 additions & 0 deletions Sources/NTPClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,9 @@ final class NTPClient {
return
}

print(callbackType)
print(data)

guard let info = info else {
return
}
Expand Down
2 changes: 1 addition & 1 deletion Tests/KronosTests/DNSResolverTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ final class DNSResolverTests: XCTestCase {

func testResolveOneIP() {
let expectation = self.expectation(description: "Query host's DNS for a single IP")
DNSResolver.resolve(host: "test.com") { addresses in
DNSResolver.resolve(host: "example.com") { addresses in
XCTAssertEqual(addresses.count, 1)
expectation.fulfill()
}
Expand Down
11 changes: 6 additions & 5 deletions Tests/KronosTests/NTPClientTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,32 +19,33 @@ final class NTPClientTests: XCTestCase {
}
}

self.waitForExpectations(timeout: 10)
self.waitForExpectations(timeout: 20)
}

func testQueryPool() {
let expectation = self.expectation(description: "Offset from ref clock to local clock are accurate")
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)
expectation.fulfill()
}
}

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)
}
}
Loading