Skip to content

fix: flaky test #4038

Merged
dd-mergequeue[bot] merged 1 commit into
mainfrom
raphael/fix_flaky_test
Oct 8, 2025
Merged

fix: flaky test #4038
dd-mergequeue[bot] merged 1 commit into
mainfrom
raphael/fix_flaky_test

Conversation

@raphaelgavache

Copy link
Copy Markdown
Member

What does this PR do?

Fix flakyness of testAsyncSpanRace which is called by 2 tests TestAsyncSpanRacePartialFlush and TestAsyncSpanRace. Only the first one was protected of the race of parsing span.meta while meta can be changed in the payload enqueuer.

Race was caught in

internal/runtime/maps.fatal({0x12e0767?, 0x3e82344c?})
	/opt/hostedtoolcache/go/1.24.7/x64/src/runtime/panic.go:1058 +0x18
internal/runtime/maps.(*Iter).Next(0xc034ed80c0?)
	/opt/hostedtoolcache/go/1.24.7/x64/src/internal/runtime/maps/table.go:683 +0x86
github.com/DataDog/dd-trace-go/v2/ddtrace/tracer.testAsyncSpanRace.func1.1()
	/home/runner/work/dd-trace-go/dd-trace-go/ddtrace/tracer/spancontext_test.go:207 +0x14c
created by github.com/DataDog/dd-trace-go/v2/ddtrace/tracer.testAsyncSpanRace.func1 in goroutine 6261
	/home/runner/work/dd-trace-go/dd-trace-go/ddtrace/tracer/spancontext_test.go:189 +0x15d

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.
  • New code is free of linting errors. You can check this by running ./scripts/lint.sh locally.
  • 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.

Unsure? Have a question? Request a review!

@raphaelgavache
raphaelgavache requested a review from a team as a code owner October 8, 2025 14:05
@pr-commenter

pr-commenter Bot commented Oct 8, 2025

Copy link
Copy Markdown

Benchmarks

Benchmark execution time: 2025-10-08 14:20:06

Comparing candidate commit 58297b1 in PR branch raphael/fix_flaky_test with baseline commit 39db6b7 in branch main.

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

@datadog-datadog-prod-us1

datadog-datadog-prod-us1 Bot commented Oct 8, 2025

Copy link
Copy Markdown

⚠️ Tests

⚠️ Warnings

❄️ 2 New flaky tests detected

TestReportHealthMetricsAtInterval from github.com/DataDog/dd-trace-go/v2/ddtrace/tracer (Datadog) (✨ Fix with BitsAI)
Failed

=== RUN   TestReportHealthMetricsAtInterval
    metrics_test.go:65: 
        	Error Trace:	/home/runner/work/dd-trace-go/dd-trace-go/ddtrace/tracer/metrics_test.go:65
        	Error:      	Not equal: 
        	            	expected: 1
        	            	actual  : 0
        	Test:       	TestReportHealthMetricsAtInterval
--- FAIL: TestReportHealthMetricsAtInterval (0.09s)
TestSpanString from github.com/DataDog/dd-trace-go/v2/ddtrace/tracer (Datadog) (✨ Fix with BitsAI)
Failed

=== RUN   TestSpanString
coverage: 55.6% of statements

🧪 1 Test failed

TestMain from github.com/DataDog/dd-trace-go/v2/ddtrace/tracer (Datadog) (✨ Fix with BitsAI)
Failed

panic: test timed out after 10m0s
	running tests:
		TestSpanString (9m5s)

goroutine 4937 [running]:
testing.(*M).startAlarm.func1()
	/opt/hostedtoolcache/go/1.25.2/x64/src/testing/testing.go:2682 +0x605
created by time.goFunc
...
This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 58297b1 | Docs | Was this helpful? Give us feedback!

@raphaelgavache

Copy link
Copy Markdown
Member Author

/merge

@dd-devflow-routing-codex

dd-devflow-routing-codex Bot commented Oct 8, 2025

Copy link
Copy Markdown

View all feedbacks in Devflow UI.

2025-10-08 14:44:32 UTC ℹ️ Start processing command /merge


2025-10-08 14:44:37 UTC ℹ️ MergeQueue: pull request added to the queue

The expected merge time in main is approximately 18m (p90).


2025-10-08 14:59:49 UTC ℹ️ MergeQueue: This merge request was merged

@dd-mergequeue
dd-mergequeue Bot merged commit 17bf3c6 into main Oct 8, 2025
270 of 274 checks passed
@dd-mergequeue
dd-mergequeue Bot deleted the raphael/fix_flaky_test branch October 8, 2025 14:59
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.

2 participants