Skip to content

DnsAddressResolverGroupTest: Use a mock DNS server instead of resolving netty.io over the network - #17566

Merged
normanmaurer merged 2 commits into
4.2from
cache_test_fix
Sep 21, 2026
Merged

normanmaurer merged 2 commits into
4.2from
cache_test_fix

Conversation

@normanmaurer

Copy link
Copy Markdown
Member

Motivation:

testSharedDNSCacheAcrossEventLoops resolved the real netty.io hostname
over the network to verify that DnsAddressResolverGroup shares its DNS
cache across EventLoops. netty.io is fronted by Cloudflare, and live
queries can return different edge IPs on different lookups, which made
the assertSame check flaky regardless of whether the cache was actually
shared.

Modification:

Use a TestDnsServer (as already done in DnsNameResolverTest) backed by
a RecordStore that always returns a single, fixed A record for
netty.io, and point the resolver's nameServerProvider at it. This makes
both resolutions deterministic so the assertion only depends on the
cache-sharing behavior under test.

Result:

testSharedDNSCacheAcrossEventLoops no longer depends on the live DNS
answer for netty.io and is no longer flaky due to external network
behavior.

…ng netty.io over the network

Motivation:

testSharedDNSCacheAcrossEventLoops resolved the real netty.io hostname
over the network to verify that DnsAddressResolverGroup shares its DNS
cache across EventLoops. netty.io is fronted by Cloudflare, and live
queries can return different edge IPs on different lookups, which made
the assertSame check flaky regardless of whether the cache was actually
shared.

Modification:

Use a TestDnsServer (as already done in DnsNameResolverTest) backed by
a RecordStore that always returns a single, fixed A record for
netty.io, and point the resolver's nameServerProvider at it. This makes
both resolutions deterministic so the assertion only depends on the
cache-sharing behavior under test.

Result:

testSharedDNSCacheAcrossEventLoops no longer depends on the live DNS
answer for netty.io and is no longer flaky due to external network
behavior.
@normanmaurer normanmaurer added this to the 4.2.19.Final milestone Sep 21, 2026
@normanmaurer normanmaurer added needs-cherry-pick-4.1 This PR should be cherry-picked to 4.1 once merged. needs-cherry-pick-5.0 This PR should be cherry-picked to 5.0 once merged. labels Sep 21, 2026
@normanmaurer

Copy link
Copy Markdown
Member Author

This hopefully makes the test non-flaky

@testlens-app

testlens-app Bot commented Sep 21, 2026

Copy link
Copy Markdown

✅ All tests passed ✅

🏷️ Commit: 053da5c
▶️ Tests: 468414 executed
⚪️ Checks: 25/25 completed


Learn more about TestLens at testlens.app/docs.

@normanmaurer
normanmaurer merged commit e9694df into 4.2 Sep 21, 2026
26 checks passed
@normanmaurer
normanmaurer deleted the cache_test_fix branch September 21, 2026 15:52
@netty-project-bot

Copy link
Copy Markdown
Contributor

Could not create auto-port PR.
Got conflicts when cherry-picking onto 4.1.

@netty-project-bot

Copy link
Copy Markdown
Contributor

Auto-port PR for 5.0: #17576

@normanmaurer

Copy link
Copy Markdown
Member Author

Port for 4.1 #17577

normanmaurer added a commit that referenced this pull request Sep 22, 2026
…esolving netty.io over the network (#17566) (#17577)

Motivation:

testSharedDNSCacheAcrossEventLoops resolved the real netty.io hostname
over the network to verify that DnsAddressResolverGroup shares its DNS
cache across EventLoops. netty.io is fronted by Cloudflare, and live
queries can return different edge IPs on different lookups, which made
the assertSame check flaky regardless of whether the cache was actually
shared.

Modification:

Use a TestDnsServer (as already done in DnsNameResolverTest) backed by
a RecordStore that always returns a single, fixed A record for
netty.io, and point the resolver's nameServerProvider at it. This makes
both resolutions deterministic so the assertion only depends on the
cache-sharing behavior under test.

Result:

testSharedDNSCacheAcrossEventLoops no longer depends on the live DNS
answer for netty.io and is no longer flaky due to external network
behavior.
normanmaurer added a commit that referenced this pull request Sep 22, 2026
…tead of resolving netty.io over the network (#17576)

Auto-port of #17566 to 5.0
Cherry-picked commit: e9694df

---
Motivation:

testSharedDNSCacheAcrossEventLoops resolved the real netty.io hostname
over the network to verify that DnsAddressResolverGroup shares its DNS
cache across EventLoops. netty.io is fronted by Cloudflare, and live
queries can return different edge IPs on different lookups, which made
the assertSame check flaky regardless of whether the cache was actually
shared.

Modification:

Use a TestDnsServer (as already done in DnsNameResolverTest) backed by
a RecordStore that always returns a single, fixed A record for
netty.io, and point the resolver's nameServerProvider at it. This makes
both resolutions deterministic so the assertion only depends on the
cache-sharing behavior under test.

Result:

testSharedDNSCacheAcrossEventLoops no longer depends on the live DNS
answer for netty.io and is no longer flaky due to external network
behavior.

Co-authored-by: Norman Maurer <[email protected]>
@normanmaurer normanmaurer removed the needs-cherry-pick-4.1 This PR should be cherry-picked to 4.1 once merged. label Oct 16, 2026
lltopk pushed a commit to lltopk/netty that referenced this pull request Oct 24, 2026
…esolving netty.io over the network (netty#17566) (netty#17577)

Motivation:

testSharedDNSCacheAcrossEventLoops resolved the real netty.io hostname
over the network to verify that DnsAddressResolverGroup shares its DNS
cache across EventLoops. netty.io is fronted by Cloudflare, and live
queries can return different edge IPs on different lookups, which made
the assertSame check flaky regardless of whether the cache was actually
shared.

Modification:

Use a TestDnsServer (as already done in DnsNameResolverTest) backed by
a RecordStore that always returns a single, fixed A record for
netty.io, and point the resolver's nameServerProvider at it. This makes
both resolutions deterministic so the assertion only depends on the
cache-sharing behavior under test.

Result:

testSharedDNSCacheAcrossEventLoops no longer depends on the live DNS
answer for netty.io and is no longer flaky due to external network
behavior.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants