wip: add support for parsing JUnit testcase lifecycle#3823
Conversation
Signed-off-by: Bryce Palmer <bpalmer@redhat.com>
|
Pipeline controller notification For optional jobs, comment This repository is configured in: automatic mode |
|
Skipping CI for Draft Pull Request. |
WalkthroughJUnit test cases now carry lifecycle XML metadata, which is represented in extracted test case entries. The Prow loader propagates this value, and tests cover passing and failing cases while preserving existing fields. ChangesJUnit lifecycle propagation
🚥 Pre-merge checks | ✅ 20 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (20 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: everettraven The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
pkg/dataloader/prowloader/prow.go (1)
1713-1727: 🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick winPreserve lifecycle metadata for duplicate test cases.
When repeated
(suite, test)entries are collapsed into a flake, Lifecycle is retained only from the first occurrence. If an earlier retry lacks the attribute and a later retry provides it, the extracted entry silently loses the metadata. Define a conflict policy and at minimum fill an empty existing value from a later non-empty value, with a regression test.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@pkg/dataloader/prowloader/prow.go` around lines 1713 - 1727, Update the duplicate test-case handling around testCases so that when an existing entry has an empty Lifecycle and a later occurrence provides a non-empty value, the existing entry adopts that value, including when the status is converted to Flake. Define the empty-versus-non-empty precedence consistently with the existing Output behavior, and add a regression test covering this retry sequence.
🧹 Nitpick comments (1)
pkg/dataloader/prowloader/extract_test_cases_test.go (1)
147-183: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winAdd coverage for the XML boundary.
These tests populate
Lifecycledirectly, so they do not verify thatxml:"lifecycle,attr"actually parses incoming JUnit XML. Add a fixture or unmarshaling test, plus a duplicate/flake case covering lifecycle preservation. As per coding guidelines, new or modified functionality should include test coverage.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@pkg/dataloader/prowloader/extract_test_cases_test.go` around lines 147 - 183, Add XML unmarshaling coverage in the extract test cases tests so lifecycle values are read from a JUnit XML lifecycle attribute rather than assigned directly on TestCase objects. Include both a normal lifecycle case and a duplicate/flake case, then verify the extracted entries preserve each lifecycle value.Source: Coding guidelines
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@pkg/dataloader/prowloader/prow.go`:
- Line 1720: Update prowJobRunTestRow construction in prowJobRunTestsFromGCS to
include the Lifecycle value from each TestCaseEntry, and extend the row contract
or struct as needed so the metadata is preserved in the loader results.
---
Outside diff comments:
In `@pkg/dataloader/prowloader/prow.go`:
- Around line 1713-1727: Update the duplicate test-case handling around
testCases so that when an existing entry has an empty Lifecycle and a later
occurrence provides a non-empty value, the existing entry adopts that value,
including when the status is converted to Flake. Define the
empty-versus-non-empty precedence consistently with the existing Output
behavior, and add a regression test covering this retry sequence.
---
Nitpick comments:
In `@pkg/dataloader/prowloader/extract_test_cases_test.go`:
- Around line 147-183: Add XML unmarshaling coverage in the extract test cases
tests so lifecycle values are read from a JUnit XML lifecycle attribute rather
than assigned directly on TestCase objects. Include both a normal lifecycle case
and a duplicate/flake case, then verify the extracted entries preserve each
lifecycle value.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository YAML (base), Central YAML (inherited)
Review profile: CHILL
Plan: Enterprise
Run ID: b7ef5cd8-3405-40d1-ab8f-d277c4797cec
📒 Files selected for processing (4)
pkg/apis/junit/types.gopkg/dataloader/prowloader/extract_test_cases_test.gopkg/dataloader/prowloader/prow.gopkg/dataloader/prowloader/types/types.go
| Status: int(status), | ||
| Duration: tc.Duration, | ||
| Output: output, | ||
| Lifecycle: tc.Lifecycle, |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift
Propagate Lifecycle into the returned test rows.
extractTestCases now stores the value in TestCaseEntry, but prowJobRunTestsFromGCS builds prowJobRunTestRow values without assigning Lifecycle at Lines 1676-1686. The metadata is therefore dropped before this loader returns its results; extend the row contract and copy the field there as well.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@pkg/dataloader/prowloader/prow.go` at line 1720, Update prowJobRunTestRow
construction in prowJobRunTestsFromGCS to include the Lifecycle value from each
TestCaseEntry, and extend the row contract or struct as needed so the metadata
is preserved in the loader results.
Summary by CodeRabbit