Skip to content

Commit

Permalink
add SRV record async test
Browse files Browse the repository at this point in the history
  • Loading branch information
novi committed Sep 17, 2019
1 parent adfab33 commit 08dd4a5
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions Tests/DNSClientTests/DNSClientTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,24 @@ final class DNSClientTests: XCTestCase {
let answers = try dnsClient.getSRVRecords(from: "_mongodb._tcp.ok0-xkvc1.mongodb.net").wait()
XCTAssertGreaterThanOrEqual(answers.count, 1, "The returned answers should be greater than or equal to 1")
}

func testSRVRecordsAsync() throws {
let expectation = self.expectation(description: "getSRVRecords")

DNSClient.connect(on: group, host: "8.8.8.8").flatMap({ client in
client.getSRVRecords(from: "_mongodb._tcp.ok0-xkvc1.mongodb.net")
}).whenComplete { (result) in
switch result {
case .failure(let error):
XCTFail("\(error)")
case .success(let answers):
print(answers)
XCTAssertGreaterThanOrEqual(answers.count, 1, "The returned answers should be greater than or equal to 1")
}
expectation.fulfill()
}
self.waitForExpectations(timeout: 5, handler: nil)
}

static var allTests = [
("testAQuery", testAQuery),
Expand Down

0 comments on commit 08dd4a5

Please sign in to comment.