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

contrib/miekg/dns: use random port for test #3164

Merged
merged 3 commits into from
Feb 7, 2025

Conversation

rarguelloF
Copy link
Contributor

@rarguelloF rarguelloF commented Feb 7, 2025

What does this PR do?

Attempt to fix flaky test by using a random port instead of 2020.

Failed

=== RUN   TestExchangeContext
    dns_test.go:47: listen udp 127.0.0.1:2020: bind: address already in use
    dns_test.go:85: 
        	Error Trace:	/home/runner/work/dd-trace-go/dd-trace-go/contrib/miekg/dns/dns_test.go:85
        	Error:      	Received unexpected error:
        	            	read udp 127.0.0.1:45449->127.0.0.1:2020: read: connection refused
        	Test:       	TestExchangeContext
    dns_test.go:53: 
        	Error Trace:	/home/runner/work/dd-trace-go/dd-trace-go/contrib/miekg/dns/dns_test.go:53
        	            				/home/runner/work/dd-trace-go/dd-trace-go/contrib/miekg/dns/dns_test.go:90
        	Error:      	Received unexpected error:
        	            	dns: server not started
        	Test:       	TestExchangeContext
--- FAIL: TestExchangeContext (10.05s)

In addition, it changes the way the local server is started. Took inspiration on how it is done in the original library.

Ran the tests in this packages a few times with count=1000 and observed no flakes so far.

Motivation

Reviewer's Checklist

  • Changed code has unit tests for its functionality at or near 100% coverage.
  • System-Tests covering this feature have been added and enabled with the va.b.c-dev version tag.
  • There is a benchmark for any new code, or changes to existing code.
  • If this interacts with the agent in a new way, a system test has been added.
  • Add an appropriate team label so this PR gets put in the right place for the release notes.
  • Non-trivial go.mod changes, e.g. adding new modules, are reviewed by @DataDog/dd-trace-go-guild.
  • For internal contributors, a matching PR should be created to the v2-dev branch and reviewed by @DataDog/apm-go.

Unsure? Have a question? Request a review!

@rarguelloF rarguelloF requested review from a team as code owners February 7, 2025 10:53
@github-actions github-actions bot added the apm:ecosystem contrib/* related feature requests or bugs label Feb 7, 2025
@datadog-datadog-prod-us1
Copy link

datadog-datadog-prod-us1 bot commented Feb 7, 2025

Datadog Report

Branch report: rarguelloF/APMLP-378/dns-flaky-test
Commit report: c5db0b6
Test service: dd-trace-go

✅ 0 Failed, 5226 Passed, 73 Skipped, 1m 48.05s Total Time

@pr-commenter
Copy link

pr-commenter bot commented Feb 7, 2025

Benchmarks

Benchmark execution time: 2025-02-07 16:47:50

Comparing candidate commit f2ae871 in PR branch rarguelloF/APMLP-378/dns-flaky-test with baseline commit f11947f in branch main.

Found 0 performance improvements and 0 performance regressions! Performance is the same for 62 metrics, 0 unstable metrics.

Copy link
Contributor

@hannahkm hannahkm left a comment

Choose a reason for hiding this comment

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

LGTM! Tested on Mac and Windows and it looks good. Thank you! 🙏🏼

@hannahkm hannahkm enabled auto-merge (squash) February 7, 2025 18:09
@hannahkm hannahkm merged commit e08fe35 into main Feb 7, 2025
175 of 176 checks passed
@hannahkm hannahkm deleted the rarguelloF/APMLP-378/dns-flaky-test branch February 7, 2025 18:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
apm:ecosystem contrib/* related feature requests or bugs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants