You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
cargo-nextest does not include the file path for test cases when generating junit.xml. This script runs after the junit.xml is generated by nextest and uses cargo-metadata to resolve the filename for tests.
Motivation
The Test Optimization tool uses the file attribute and the git CODEOWNERS file to map test failures to code owners to provide granular alerting capabilities.
Additional Notes
Comments in the code explain this but two things make this less trivial than expected:
Unit tests and integration tests are reported differently in the junit.xml file.
Some crates don't match on their package name and the target name. For example, libdd-profiling-ffi has a lib target of datadog_profiling_ffi. For unit tests we need to include a fallback to check the alias if it exists to properly resolve to the file name.
How to test the change?
Generate the Junit file locally with cargo nextest run --profile ci --workspace to target/nextest/ci/junit.xml
Run the script to add file attributes with cargo run --bin add_junit_file_attributes -- target/nextest/ci/junit.xml -o junit_with_files.xml
I verified all tests have codeowners in Test Optimization on my branch
❌ Patch coverage is 72.79152% with 77 lines in your changes missing coverage. Please review.
✅ Project coverage is 71.09%. Comparing base (8fe097c) to head (a72a900).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
cargo-nextest does not include the file path for test cases when generating junit.xml. This script runs after the junit.xml is generated by nextest and uses cargo-metadata to resolve the filename for tests.
Motivation
The Test Optimization tool uses the file attribute and the git CODEOWNERS file to map test failures to code owners to provide granular alerting capabilities.
Additional Notes
Comments in the code explain this but two things make this less trivial than expected:
libdd-profiling-ffihas a lib target ofdatadog_profiling_ffi. For unit tests we need to include a fallback to check the alias if it exists to properly resolve to the file name.How to test the change?
Generate the Junit file locally with
cargo nextest run --profile ci --workspacetotarget/nextest/ci/junit.xmlRun the script to add file attributes with
cargo run --bin add_junit_file_attributes -- target/nextest/ci/junit.xml -o junit_with_files.xmlI verified all tests have codeowners in Test Optimization on my branch