Open codefromthecrypt opened 5 years ago
@anuraaga PS this might be up your alley. In general it is a missing piece when folks do "mock web servers" as DNS is always punted.
I've used Netty's test DNS server before - https://github.com/netty/netty/blob/4.1/resolver-dns/src/test/java/io/netty/resolver/dns/TestDnsServer.java
It's a lot of code, I'm hoping I can find a way that doesn't require copying all of that in ;)
DnsEndpointGroup.endpoints()
returns empty on unresolved addresses. This is a problem in testing because sometime you want to test code that blocks until DNS resolves. In Zipkin, this prevents a "first request" error users would otherwise see.Lacking a
MockDnsServer
, we can only test usage ofDnsEndpointGroup
usage like this with resolvable hosts. However, in CI or offline laptops, this can lead to flakey tests.It would be nice to be able to control the resolver of
DnsEndpointGroup
or have an alternative such asMockDnsServer