Skip to content

Fix flaky Data Streams assertions in HTTP tests#11916

Open
AlexeyKuznetsov-DD wants to merge 2 commits into
masterfrom
alexeyk/fix-verifyAll-null
Open

Fix flaky Data Streams assertions in HTTP tests#11916
AlexeyKuznetsov-DD wants to merge 2 commits into
masterfrom
alexeyk/fix-verifyAll-null

Conversation

@AlexeyKuznetsov-DD

@AlexeyKuznetsov-DD AlexeyKuznetsov-DD commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

What Does This Do

Adds waitForGroup to RecordingDatastreamsPayloadWriter and uses it in the shared HTTP tests to wait for the expected root StatsGroup before calling verifyAll.

Note: Test changed a lot of places, but they all identical.

Motivation

These tests were flaky on GitLab CI because Data Streams groups are reported asynchronously. waitForGroups(1) only guaranteed that any group existed, so the immediate groups.find { it.parentHash == 0 } could return null before the expected root group arrived. A Develocity retry could pass with a more favorable scheduling order.

waitForGroup waits for the matching group with a bounded timeout, removing that race and producing a clearer failure if the group never arrives.

Additional Notes

Before the fix tests failed on GitLab Ci:

org.spockframework.runtime.SpockAssertionError: Target of 'verifyAll' block must not be null

Target of 'verifyAll' block must not be null
	at spock.lang.Specification.verifyAll(Specification.java:286)
	at datadog.trace.agent.test.base.HttpServerTest.test success with #count requests(HttpServerTest.groovy:685)

Verification:

  • Added targeted test: RecordingDatastreamsPayloadWriterTest.
  • Manually tested on GitLab CI after the fix - looks good (1 pass).

@AlexeyKuznetsov-DD AlexeyKuznetsov-DD added type: bug fix Bug fix comp: testing Testing tag: ai generated Largely based on code generated by an AI or LLM tag: no release note tag: override groovy enforcement Override the "Enforce Groovy Migration" check labels Jul 11, 2026
@AlexeyKuznetsov-DD AlexeyKuznetsov-DD self-assigned this Jul 11, 2026
@AlexeyKuznetsov-DD AlexeyKuznetsov-DD marked this pull request as ready for review July 11, 2026 02:18
@AlexeyKuznetsov-DD AlexeyKuznetsov-DD requested review from a team as code owners July 11, 2026 02:18

@datadog-datadog-prod-us1-2 datadog-datadog-prod-us1-2 Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Datadog Autotest: PASS

More details

PR eliminates test flakiness by adding waitForGroup() to properly wait for asynchronous Data Streams group arrival before assertions. Implementation correctly synchronizes access, respects timeouts, and returns matching groups. All 47 test migrations are consistent and safe. No behavioral regressions detected.

Was this helpful? React 👍 or 👎

📊 Validated against 5 scenarios · Open Bits AI session

🤖 Datadog Autotest · Commit bc39012 · What is Autotest? · Any feedback? Reach out in #autotest

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp: testing Testing tag: ai generated Largely based on code generated by an AI or LLM tag: no release note tag: override groovy enforcement Override the "Enforce Groovy Migration" check type: bug fix Bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant