Skip to content

feat(ci): add file attribute to junit.xml from cargo-nextest [APMSP-3364]#239

Open
bantonsson wants to merge 2 commits into
mainfrom
ban/nextest-junit-file-attr
Open

feat(ci): add file attribute to junit.xml from cargo-nextest [APMSP-3364]#239
bantonsson wants to merge 2 commits into
mainfrom
ban/nextest-junit-file-attr

Conversation

@bantonsson
Copy link
Copy Markdown
Collaborator

What does this PR do?

Add a tools crate with an add_junit_file_attributes binary that enriches JUnit XML output from cargo-nextest with the 'file' attribute on each element. Test Optimization requires this attribute to resolve test owners via CODEOWNERS.

The binary uses cargo metadata to map (package, target) pairs to source file paths. Unit tests use module-path heuristics (src/.rs / src//mod.rs) to narrow down to the specific file; integration tests and binaries resolve directly from their target src_path.

This is the same fix applied to libdatadog in DataDog/libdatadog#1487.

The new step runs after cargo nextest (on success or failure) and before JUnit report upload, so both the GitHub check report and the Datadog CI upload receive enriched XML.

Motivation

Green CI metrics showing a lot of unowned tests.

Additional Notes

@bantonsson bantonsson requested a review from a team as a code owner May 28, 2026 14:13
@datadog-prod-us1-4
Copy link
Copy Markdown

datadog-prod-us1-4 Bot commented May 28, 2026

Tests

🎉 All green!

🧪 All tests passed
❄️ No new flaky tests detected

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 9c36d1f | Docs | Datadog PR Page | Give us feedback!

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

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: a557407c83

ℹ️ 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 tools/src/junit_file_attributes.rs
@bantonsson bantonsson force-pushed the ban/nextest-junit-file-attr branch 2 times, most recently from 74a19b4 to 825c4a0 Compare May 28, 2026 14:27
…MSP-3376]

Add scripts/pack-system-tests-artifact.sh to replace the hardcoded
`cp -r datadog-opentelemetry Cargo.toml` in the build-artifacts CI job.

The old approach broke when a new crate was added at the workspace root:
Cargo.toml listed it as a member but its source was absent from the
artifact, causing the system-test Docker build to fail.

The script reads [workspace] members from Cargo.toml, deduplicates
nested paths, and copies the unique root directories. New workspace
crates are included automatically.
Add a tools crate with an add_junit_file_attributes binary that enriches
JUnit XML output from cargo-nextest with the 'file' attribute on each
<testcase> element. Test Optimization requires this attribute to resolve
test owners via CODEOWNERS.

The binary uses cargo metadata to map (package, target) pairs to source
file paths. Unit tests use module-path heuristics (src/<module>.rs /
src/<module>/mod.rs) to narrow down to the specific file; integration
tests and binaries resolve directly from their target src_path.

This is the same fix applied to libdatadog in APMSP-2547.

The new step runs after cargo nextest (on success or failure) and before
JUnit report upload, so both the GitHub check report and the Datadog CI
upload receive enriched XML.
@bantonsson bantonsson force-pushed the ban/nextest-junit-file-attr branch from 6ee1993 to 9c36d1f Compare May 29, 2026 09:32
@bantonsson bantonsson changed the title ci: add file attribute to junit.xml from cargo-nextest [APMSP-3364] fix(ci): add file attribute to junit.xml from cargo-nextest [APMSP-3364] May 29, 2026
@bantonsson bantonsson changed the title fix(ci): add file attribute to junit.xml from cargo-nextest [APMSP-3364] feat(ci): add file attribute to junit.xml from cargo-nextest [APMSP-3364] May 29, 2026
@bantonsson bantonsson changed the base branch from main to ban/move-system-tests-build May 29, 2026 09:34
Base automatically changed from ban/move-system-tests-build to main May 29, 2026 09:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants