Skip to content

fix(hack): write the coverage mode line and data to the same file - #2935

Open
im-Toqeer-506 wants to merge 1 commit into
Project-HAMi:masterfrom
im-Toqeer-506:fix/coverage-profile-mode-line
Open

fix(hack): write the coverage mode line and data to the same file#2935
im-Toqeer-506 wants to merge 1 commit into
Project-HAMi:masterfrom
im-Toqeer-506:fix/coverage-profile-mode-line

Conversation

@im-Toqeer-506

@im-Toqeer-506 im-Toqeer-506 commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

What type of PR is this?

/kind bug

What this PR does / why we need it:

Fixes the coverage output in hack/unit-test.sh.

The script was writing the coverage header and data to different files. Because of this:

  • make test reported 0% coverage.
  • The coverage file uploaded to Codecov was invalid because it had no mode: header.
  • Running make test multiple times appended duplicate coverage data.

This PR writes the header and data to the same file and truncates the file before writing.

Which issue(s) this PR fixes:

Fixes #2933

AI assistance disclosure:
I used an AI assistant to verify the implementation and test cases. I reviewed the changes and validation results.

Hardware validation:
Not applicable. This change only affects test/coverage tooling and does not change production or device code.

Does this PR introduce a user-facing change?

NONE

AI assistance disclosure:

I used an AI assistant to verify the implementation and test cases. I reviewed the changes and validation results.

Summary by CodeRabbit

  • Bug Fixes
    • Fixed coverage report generation so merged results are written to the expected output location.
    • Prevented duplicate coverage mode lines when running coverage aggregation repeatedly.

Signed-off-by: M Toqeer Zia <muhammadtoqeerzia586694@gmail.com>
@hami-robot hami-robot Bot added the kind/bug Something isn't working label Sep 1, 2026
@hami-robot
hami-robot Bot requested review from FouoF and archlitchi September 1, 2026 14:17
@hami-robot

hami-robot Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: im-Toqeer-506
Once this PR has been reviewed and has the lgtm label, please assign dsfans2014 for approval. For more information see the Kubernetes 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

coderabbitai Bot commented Sep 1, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Team

Run ID: 93f54f26-7fd4-46cb-b21b-48b131e43ab4

📥 Commits

Reviewing files that changed from the base of the PR and between e6932f5 and 207efd7.

📒 Files selected for processing (1)
  • hack/unit-test.sh

Included review availability: Your plan provides up to 8 included reviews per hour; 6 remain after this review.


📝 Walkthrough

Walkthrough

The unit test script now writes the coverage mode line and merged profile data to ./_output/coverage/coverage.out. The coverage report command reads this same file.

Changes

Coverage Output Correction

Layer / File(s) Summary
Unify coverage profile output
hack/unit-test.sh
The coverage script writes the mode line and merged profile data to ./_output/coverage/coverage.out and runs go tool cover -func against that file.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to 207ef

This localized change makes the coverage header and merged data use the same truncated file, correcting coverage reporting without affecting production behavior. No actionable merge-blocking risk remains beyond normal checks and review.

Suggested reviewers: archlitchi, fouof

Poem

A rabbit found one coverage file,
With header and data in a tidy pile.
The report now reads the same path,
No repeated lines remain in its math.
Hop, hop—the tests show their style!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main coverage file handling fix.
Linked Issues check ✅ Passed The changes satisfy issue #2933 by writing the coverage mode header and merged data to ./_output/coverage/coverage.out, truncating before writing, and using that file for go tool cover. The changes al…
Out of Scope Changes check ✅ Passed The changes are limited to hack/unit-test.sh and directly support the coverage tooling requirements in issue #2933. No unrelated production, device, or CI workflow changes are present.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 1…
Full details: Linked Issues check

Explanation

The changes satisfy issue #2933 by writing the coverage mode header and merged data to ./_output/coverage/coverage.out, truncating before writing, and using that file for go tool cover. The changes also avoid CI and production code changes.

Full details: Docstring Coverage

Explanation

No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 1 files.

✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@codecov

codecov Bot commented Sep 1, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

Flag Coverage Δ
unittests 70.33% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

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

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

Labels

kind/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ack/unit-test.sh writes the coverage header and data to different files, so make test always reports 0%

1 participant