Skip to content

test: make tests independent of containerID ordering#379

Merged
vickenty merged 4 commits into
DataDog:masterfrom
KowalskiThomas:kowalski/test-make-tests-independent-of-containerid-ordering
Jun 22, 2026
Merged

test: make tests independent of containerID ordering#379
vickenty merged 4 commits into
DataDog:masterfrom
KowalskiThomas:kowalski/test-make-tests-independent-of-containerid-ordering

Conversation

@KowalskiThomas

@KowalskiThomas KowalskiThomas commented May 18, 2026

Copy link
Copy Markdown
Contributor

What is this PR?

While trying to make some changes on datadog-go, I've noticed that some tests would not work when run all at the same time. This should help with that when running

go test ./statsd/ -timeout 300s -race -count=1

Specifically, the container ID detection logic (in container.go / container_linux.go) could return multiple candidate IDs, and tests were asserting on a specific one. The fix refactors the container detection to expose a deterministic/sorted result and updates the test helpers and test files (container_test.go, statsd_test.go, telemetry_test.go, service_check_test.go) to not rely on a particular ordering of container IDs.

@KowalskiThomas KowalskiThomas changed the title test: make tests independent of containerID ordering test: make tests independent of containerID ordering May 18, 2026
@KowalskiThomas KowalskiThomas force-pushed the kowalski/test-make-tests-independent-of-containerid-ordering branch 3 times, most recently from e1b6c7d to f9faf3f Compare May 18, 2026 16:00
@KowalskiThomas KowalskiThomas marked this pull request as ready for review May 18, 2026 16:17
@KowalskiThomas KowalskiThomas requested a review from a team as a code owner May 18, 2026 16:17

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f9faf3f3b2

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread statsd/cleanup_pre114_test.go Outdated
@KowalskiThomas KowalskiThomas force-pushed the kowalski/test-make-tests-independent-of-containerid-ordering branch from f9faf3f to 7a0082c Compare May 18, 2026 16:35
Comment thread statsd/format_test.go
Comment thread statsd/telemetry_test.go
@KowalskiThomas KowalskiThomas requested a review from vickenty May 21, 2026 10:09
@carlosroman

Copy link
Copy Markdown
Contributor

Strange, race detector has picked up an issue with some of the tests on Windows. Might be a platform specific race condition (never seen one) or could be specific to Windows code we have.

Comment thread statsd/test_helpers_test.go
Comment thread statsd/test_helpers_test.go Outdated
@datadog-prod-us1-5

This comment has been minimized.

@KowalskiThomas KowalskiThomas force-pushed the kowalski/test-make-tests-independent-of-containerid-ordering branch from a5d5e6e to 22e2d80 Compare June 5, 2026 13:27
@KowalskiThomas KowalskiThomas requested a review from atanzu June 8, 2026 08:52
@vickenty vickenty merged commit ec3b848 into DataDog:master Jun 22, 2026
53 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