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

More lenient DnsTest #474

Merged
merged 2 commits into from
Mar 19, 2023
Merged
Changes from 1 commit
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
12 changes: 9 additions & 3 deletions test-kit/shared/src/test/scala/com/comcast/ip4s/DnsTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,19 @@ class DnsTest extends CatsEffectSuite {
}

test("loopback") {
val loopbacks = Set(ip"127.0.0.1", ip"::1")
Dns[IO].loopback.flatMap { loopback =>
IO(loopbacks.contains(clue(loopback)))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need an assertion here?

}
assertIO(Dns[IO].loopback.map(_.some), IpAddress.fromString("127.0.0.1"))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to delete this line

}

test("resolve unknown host") {
Dns[IO]
.resolve(host"not.example.com")
.interceptMessage[UnknownHostException]("not.example.com: Name or service not known")
Dns[IO].resolve(host"not.example.com").void.recover { case ex: UnknownHostException =>
assert(
ex.getMessage == "not.example.com: Name or service not known" || ex.getMessage == "not.example.com: nodename nor servname provided, or not known"
)
}
}

test("reverse unknown ip") {
Expand Down