Skip to content

🤖 TRT-2622: test result aggregation: properties#5163

Open
sosiouxme wants to merge 3 commits intoopenshift:mainfrom
sosiouxme:20260506-TRT-2622-aggregator-property
Open

🤖 TRT-2622: test result aggregation: properties#5163
sosiouxme wants to merge 3 commits intoopenshift:mainfrom
sosiouxme:20260506-TRT-2622-aggregator-property

Conversation

@sosiouxme
Copy link
Copy Markdown
Member

@sosiouxme sosiouxme commented May 6, 2026

The aggregator now propagates properties of the testcases aggregated, choosing the properties of the first testcase instance as representative in the aggregated testcase.

🤖 Assisted by Claude Code

Summary by CodeRabbit

  • New Features

    • Unified property metadata for suites and cases; test cases now include lifecycle attributes.
    • Test case property values are now censored alongside other sensitive fields.
  • Tests

    • Added a test ensuring properties are preserved and propagated when aggregating results.
    • Test fixtures/sample data updated to include case-level properties.

The aggregator now propagates properties of the testcases aggregated,
choosing the properties of the first testcase instance as representative
in the aggregated testcase.

🤖 Assisted by Claude Code
Copilot AI review requested due to automatic review settings May 6, 2026 19:11
@openshift-merge-bot
Copy link
Copy Markdown
Contributor

Pipeline controller notification
This repo is configured to use the pipeline controller. Second-stage tests will be triggered either automatically or after lgtm label is added, depending on the repository configuration. The pipeline controller will automatically detect which contexts are required and will utilize /test Prow commands to trigger the second stage.

For optional jobs, comment /test ? to see a list of all defined jobs. To trigger manually all jobs from second stage use /pipeline required command.

This repository is configured in: automatic mode

@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label May 6, 2026
@openshift-ci-robot
Copy link
Copy Markdown
Contributor

openshift-ci-robot commented May 6, 2026

@sosiouxme: This pull request references TRT-2622 which is a valid jira issue.

Details

In response to this:

The aggregator now propagates properties of the testcases aggregated, choosing the properties of the first testcase instance as representative in the aggregated testcase.

🤖 Assisted by Claude Code

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci openshift-ci Bot requested review from bear-redhat and psalajova May 6, 2026 19:12
@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented May 6, 2026

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: sosiouxme
Once this PR has been reviewed and has the lgtm label, please assign deepsm007 for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 6, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Central YAML (inherited)

Review profile: CHILL

Plan: Enterprise

Run ID: edc2a1a1-4929-43fc-a026-42ed0a5111f7

📥 Commits

Reviewing files that changed from the base of the PR and between c135517 and 1f431f2.

📒 Files selected for processing (1)
  • pkg/junit/censor.go

📝 Walkthrough

Walkthrough

Reworks jUnit types to introduce a unified Property type; adds TestCase.Properties and TestCase.Lifecycle; updates censoring to scrub test-case property values; propagates properties during test-case aggregation; updates fixtures and adds a test to verify property propagation.

Changes

jUnit Type Unification, Censoring, Propagation, and Tests

Layer / File(s) Summary
Data Shape
pkg/junit/types.go
Adds exported Property type (xml:"property" with Name/Value), changes TestSuite.Properties to []*Property, adds TestCase.Lifecycle string and TestCase.Properties []*Property, removes TestSuiteProperty.
Core Calculation / Aggregation
pkg/jobrunaggregator/jobrunaggregatoranalyzer/junit.go
In aggregateTestCase, if the combined test case has no properties, copy Properties from the source test case into the combined case (after YAML/lifecycle updates).
Core Logic — Censoring
pkg/junit/censor.go
CensorTestSuite now iterates suite properties and censors TestCase.Properties[j].Value (and names) in addition to existing censoring of names, skip/failure outputs, and system out/err.
Fixtures / Testdata
pkg/junit/censor_test.go, pkg/junit/testdata/zz_fixture_TestCensorTestSuite.yaml
Updated TestSuite test fixtures to use []*Property and inserted Properties: lists into multiple TestCase entries with Name/Value entries in the YAML fixture.
Tests
pkg/jobrunaggregator/jobrunaggregatoranalyzer/analyzer_test.go
Adds TestAggregateTestCasePropagatesProperties to validate that junit.Properties propagate through aggregateTestCase and persist across further aggregations.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

🚥 Pre-merge checks | ✅ 13 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (13 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title references a Jira ticket (TRT-2622) and mentions 'test result aggregation: properties', which directly aligns with the PR's core objective of propagating properties during test case aggregation.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Go Error Handling ✅ Passed The new code added for property propagation in aggregateTestCase follows proper Go error handling. No new error operations, panic calls, or unsafe pointer dereferences were introduced in this PR.
Test Coverage For New Features ✅ Passed New functionality covered by tests: aggregation propagation logic has dedicated test; property censoring validated by existing test fixtures; XML marshaling tested via lifecycle parsing.
Stable And Deterministic Test Names ✅ Passed The PR adds a standard Go unit test (not Ginkgo) with a stable, deterministic name: TestAggregateTestCasePropagatesProperties. All test data is static and hardcoded. No dynamic identifiers found.
Test Structure And Quality ✅ Passed The custom check targets Ginkgo tests (It blocks, BeforeEach/AfterEach). This PR adds a standard Go unit test without cluster interactions, single responsibility, and mirrors existing patterns.
Microshift Test Compatibility ✅ Passed No Ginkgo e2e tests are added. The new test is a standard Go unit test using testing.T, not Ginkgo. Changes are library code for junit property propagation.
Single Node Openshift (Sno) Test Compatibility ✅ Passed This PR does not add Ginkgo e2e tests. All changes are to internal CI tools (test aggregator and jUnit parsing). The SNO compatibility check does not apply to unit tests and backend data structures.
Topology-Aware Scheduling Compatibility ✅ Passed This PR modifies test result aggregator and jUnit XML utilities only. No deployment manifests, operator code, controllers, or Kubernetes scheduling constraints present. Check not applicable.
Ote Binary Stdout Contract ✅ Passed No stdout writes in process-level code. Changes are data structure updates and aggregation logic without any fmt.Print, klog, or logging to stdout at module, main, or suite setup level.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed Check not applicable. PR adds only standard Go unit tests, not Ginkgo e2e tests. The custom check applies only to Ginkgo e2e tests per its instructions.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR extends the JUnit aggregation flow so aggregated TestCases can carry forward <properties> from the source testcases (using the first encountered testcase instance as the representative), and consolidates suite/testcase property modeling in pkg/junit.

Changes:

  • Unify test suite properties under a shared junit.Property type and add TestCase.Properties support in the JUnit types.
  • Propagate TestCase.Properties during aggregation (first testcase instance wins).
  • Add/update fixtures and tests to reflect the new struct fields and aggregation behavior.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
pkg/junit/types.go Unifies property modeling and adds TestCase.Properties to the JUnit data model.
pkg/junit/censor_test.go Updates censor test to use the unified Property type.
pkg/junit/testdata/zz_fixture_TestCensorTestSuite.yaml Updates golden fixture for the new TestCase.Properties field presence.
pkg/jobrunaggregator/jobrunaggregatoranalyzer/junit.go Copies testcase properties into the aggregated testcase (first source wins).
pkg/jobrunaggregator/jobrunaggregatoranalyzer/analyzer_test.go Adds coverage for properties propagation behavior in aggregation.
Comments suppressed due to low confidence (1)

pkg/junit/types.go:56

  • Renaming/removing the exported TestSuiteProperty type is a breaking API change for any downstream code importing pkg/junit. Consider keeping backwards compatibility by adding a type alias (e.g., type TestSuiteProperty = Property) or retaining the old name as a deprecated wrapper type.
	// Properties holds other properties of the test suite as a mapping of name to value
	Properties []*Property `xml:"properties>property,omitempty"`

	// TestCases are the test cases contained in the test suite
	TestCases []*TestCase `xml:"testcase"`

	// Children holds nested test suites
	Children []*TestSuite `xml:"testsuite"`
}

// Property contains a mapping of a property name to a value
type Property struct {
	XMLName xml.Name `xml:"property"`

	Name  string `xml:"name,attr"`
	Value string `xml:"value,attr"`
}

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread pkg/junit/types.go
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
pkg/junit/types.go (1)

41-55: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Keep a compatibility alias for TestSuiteProperty.

pkg/junit is already consumed from openshift/release, and those callers still construct []*junit.TestSuiteProperty. Replacing the exported type name here turns this into a cross-repo compile break even though the XML shape is effectively the same. A temporary alias keeps this PR safe while downstream code migrates.

Suggested compatibility shim
 // Property contains a mapping of a property name to a value
 type Property struct {
 	XMLName xml.Name `xml:"property"`

 	Name  string `xml:"name,attr"`
 	Value string `xml:"value,attr"`
 }
+
+// TestSuiteProperty is kept as an alias while downstream consumers migrate.
+type TestSuiteProperty = Property
🤖 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/junit/types.go` around lines 41 - 55, Add a backwards-compatible exported
alias named TestSuiteProperty that points to the existing Property struct so
callers constructing []*junit.TestSuiteProperty continue to compile;
specifically, add a type alias declaration like "type TestSuiteProperty =
Property" near the Property type (with a short comment explaining it’s a
compatibility shim) and keep the XML tags and original Property definition
unchanged.
🤖 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/jobrunaggregator/jobrunaggregatoranalyzer/junit.go`:
- Around line 238-247: The current logic uses len(combined.Properties) to decide
whether to copy properties from toAdd, which can copy properties from a later
testcase if the first aggregated testcase had no properties; instead, introduce
or use a boolean sentinel that marks whether the first testcase has already been
aggregated (e.g., a field or local flag like firstAggregated) and change the
condition to check that flag when deciding to copy properties from toAdd to
combined; update the aggregation site where combined and toAdd are handled so
that when you process the very first testcase you set firstAggregated=true and
only allow properties to be copied when firstAggregated is false (use the
symbols combined, toAdd, combined.Properties, and the new firstAggregated flag
in your changes).

In `@pkg/junit/censor_test.go`:
- Around line 16-18: CensorTestSuite currently redacts suite-level Properties
but omits testcase-level Properties on TestSuite.TestCases; update the
CensorTestSuite function to iterate over each TestCase.Properties and call
censored(censor, ...) for both Name and Value (use the same pattern as suite
Properties), ensuring you reference TestSuite.TestCases[i].Properties and the
censored(censor, ...) helper; then update pkg/junit/censor_test.go to add
Properties with secret values to the testcase fixtures (the cases around the
existing lines where Properties are asserted) and extend the tests to verify
those testcase-level property names and values are redacted.

---

Outside diff comments:
In `@pkg/junit/types.go`:
- Around line 41-55: Add a backwards-compatible exported alias named
TestSuiteProperty that points to the existing Property struct so callers
constructing []*junit.TestSuiteProperty continue to compile; specifically, add a
type alias declaration like "type TestSuiteProperty = Property" near the
Property type (with a short comment explaining it’s a compatibility shim) and
keep the XML tags and original Property definition unchanged.
🪄 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: 227929de-8311-4572-89c9-b07a79b2ee76

📥 Commits

Reviewing files that changed from the base of the PR and between 7a79153 and 1f57a25.

📒 Files selected for processing (5)
  • pkg/jobrunaggregator/jobrunaggregatoranalyzer/analyzer_test.go
  • pkg/jobrunaggregator/jobrunaggregatoranalyzer/junit.go
  • pkg/junit/censor_test.go
  • pkg/junit/testdata/zz_fixture_TestCensorTestSuite.yaml
  • pkg/junit/types.go

Comment thread pkg/jobrunaggregator/jobrunaggregatoranalyzer/junit.go
Comment thread pkg/junit/censor_test.go
🤖 Assisted by Claude Code
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 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/junit/censor.go`:
- Around line 17-19: In the loop that iterates testSuite.TestCases[i].Properties
(in pkg/junit/censor.go) you must guard against nil property entries and censor
both the Value and Name fields; add a nil-check for
testSuite.TestCases[i].Properties[j] before dereferencing, and call
censored(censor, ...) on both Properties[j].Value and Properties[j].Name so
user-provided names cannot leak secrets (keep using the existing censored
function).
🪄 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: b333610c-0470-4031-9164-61ea21a03a9f

📥 Commits

Reviewing files that changed from the base of the PR and between 1f57a25 and c135517.

📒 Files selected for processing (3)
  • pkg/junit/censor.go
  • pkg/junit/censor_test.go
  • pkg/junit/testdata/zz_fixture_TestCensorTestSuite.yaml
✅ Files skipped from review due to trivial changes (1)
  • pkg/junit/censor_test.go
🚧 Files skipped from review as they are similar to previous changes (1)
  • pkg/junit/testdata/zz_fixture_TestCensorTestSuite.yaml

Comment thread pkg/junit/censor.go Outdated
Copilot AI review requested due to automatic review settings May 7, 2026 00:24
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated no new comments.

@sosiouxme
Copy link
Copy Markdown
Member Author

/override ci/prow/images

it's not me breaking it

@openshift-merge-bot
Copy link
Copy Markdown
Contributor

Scheduling tests matching the pipeline_run_if_changed or not excluded by pipeline_skip_if_only_changed parameters:
/test e2e

@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented May 7, 2026

@sosiouxme: Overrode contexts on behalf of sosiouxme: ci/prow/images

Details

In response to this:

/override ci/prow/images

it's not me breaking it

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented May 7, 2026

@sosiouxme: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/breaking-changes 1f431f2 link false /test breaking-changes
ci/prow/e2e 1f431f2 link true /test e2e

Full PR test history. Your PR dashboard.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

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

Labels

jira/valid-reference Indicates that this PR references a valid Jira ticket of any type.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants