Skip to content

feat: add status field to JSON report#2700

Merged
eddycharly merged 2 commits into
kyverno:mainfrom
Ayush-Patel-56:fix/json-report-status-2503
May 4, 2026
Merged

feat: add status field to JSON report#2700
eddycharly merged 2 commits into
kyverno:mainfrom
Ayush-Patel-56:fix/json-report-status-2503

Conversation

@Ayush-Patel-56

Copy link
Copy Markdown
Contributor

Explanation

When exporting results to JSON, Chainsaw previously omitted the final outcome (pass/fail/skipped) for tests, steps, and operations. This PR adds an explicit status field at all levels of the JSON report, allowing users and external tools to determine test outcomes directly from the JSON without needing to cross-reference JUnit XML or parse error messages.

Related issue

Fixes #2503

Proposed Changes

  • Added a status string field to OperationReport, StepReport, and TestReport in the JSON output.
  • Implemented TestReport.Failed() to roll up failure status from underlying steps and operations.
  • Updated the JSON serialization logic to derive the correct status (passed, failed, or skipped).
  • Fixed a cross-platform bug in report_test.go where hardcoded forward slashes caused test failures on Windows.
  • Added unit tests to verify the new status rollup logic.

Checklist

  • I have read the contributing guidelines.
  • I have read the PR documentation guide and followed the process including adding proof manifests to this PR.
  • This is a bug fix and I have added unit tests that prove my fix is effective.

Further Comments

The Skipped boolean was removed from the JSON struct in favor of the unified status field to keep the output clean and avoid redundancy. All existing report tests have been verified to pass on both Windows and Linux.

- Added Status field to OperationReport, StepReport, and TestReport
- Added TestReport.Failed() method to rollup failure status
- Fixed cross-platform path separator issue in report tests

Signed-off-by: Ayush Patel <[email protected]>
@Ayush-Patel-56
Ayush-Patel-56 requested a review from a team as a code owner May 1, 2026 18:39
@codecov

codecov Bot commented May 1, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 67.08%. Comparing base (db0a757) to head (87d525b).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2700      +/-   ##
==========================================
+ Coverage   66.96%   67.08%   +0.11%     
==========================================
  Files         149      149              
  Lines        5703     5723      +20     
==========================================
+ Hits         3819     3839      +20     
  Misses       1624     1624              
  Partials      260      260              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@eddycharly eddycharly added this to the v0.2.15 milestone May 4, 2026
@eddycharly
eddycharly enabled auto-merge (squash) May 4, 2026 09:26
@eddycharly
eddycharly merged commit b123888 into kyverno:main May 4, 2026
13 of 14 checks passed
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.

[Bug] JSON report lacks pass/fail status

2 participants