Skip to content

libnetwork: isolate TestDNSOptions from host DNS options - #54045

Merged
thaJeztah merged 1 commit into
moby:masterfrom
akasakariko:fix/test-dns-options-isolation
Oct 28, 2026
Merged

thaJeztah merged 1 commit into
moby:masterfrom
akasakariko:fix/test-dns-options-isolation

Conversation

@akasakariko

Copy link
Copy Markdown
Contributor

Follow up to: #54011
Requested in: #54011 (comment)

Summary

Give both sandboxes in TestDNSOptions a temporary origin resolv.conf so host options such as edns0 and trust-ad cannot leak into the assertions

Extract only the DNS test isolation change from faa2268, preserving all existing assertions and excluding the allocator test rename

Pi prepared the patch and PR draft and ran the local validation commands

Validation

  • Reproduced the failure before the fix with options edns0 trust-ad in the validation container's /etc/resolv.conf
  • The focused test and both related packages pass after the fix with and without those host options
  • Package tests with netgo journald tags, focused race tests, lint, vet, formatting and Linux/amd64 cross-compilation pass locally through Colima
Local validation commands
go test -count=1 -run '^TestDNSOptions$' -v ./daemon/libnetwork
go test -p=1 -count=1 -timeout=5m ./daemon/libnetwork ./daemon/libnetwork/internal/resolvconf
go test -tags 'netgo journald' -p=1 -count=1 -timeout=5m ./daemon/libnetwork ./daemon/libnetwork/internal/resolvconf
go test -race -p=1 -count=1 -timeout=5m -run '^(TestDNS|TestSandboxWritesFilesOnlyWhenAsked)' -v ./daemon/libnetwork
golangci-lint run --timeout=10m --config .golangci.yml ./daemon/libnetwork ./daemon/libnetwork/internal/resolvconf
go vet ./daemon/libnetwork ./daemon/libnetwork/internal/resolvconf
golangci-lint fmt --diff daemon/libnetwork/sandbox_dns_unix_test.go
test -z "$(gofmt -s -l daemon/libnetwork/sandbox_dns_unix_test.go)"
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go test -c -o /validation/dns-options-followup/libnetwork-linux-amd64.test ./daemon/libnetwork

Executed on Linux/arm64 with Go 1.26.10
Full daemon integration tests and amd64 execution were not run

Created with: Pi

Provide a temporary origin resolv.conf for both sandboxes so host options such as edns0 and trust-ad cannot affect the DNS option assertions

Signed-off-by: akasakariko <[email protected]>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟢 Approval recommended

No active review issues are reported for the change isolating TestDNSOptions from host DNS settings.

No open issues 🎉

What changed in this PR

This follow-up to #54011 makes libnetwork’s TestDNSOptions independent of host DNS settings, preventing options such as edns0 and trust-ad from affecting its assertions.

Changes:

  • Creates a temporary origin resolv.conf containing a fixed nameserver and no DNS options.
  • Uses that file for both test sandboxes, preserving existing assertions without changing production behavior.
File Description
daemon/​libnetwork/​sandbox_dns_unix_test.go Isolates both TestDNSOptions sandboxes from host resolver settings.

Review effort: Balanced

@thaJeztah thaJeztah left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, thx!

@thaJeztah
thaJeztah merged commit 5ed8b59 into moby:master Oct 28, 2026
234 of 235 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants