Skip to content

test(vGPUmonitor): expect short UUID to be skipped, not error - #2407

Merged
hami-robot[bot] merged 1 commit into
Project-HAMi:masterfrom
imantaba:fix/vgpumonitor-shortuuid-test
Aug 6, 2026
Merged

test(vGPUmonitor): expect short UUID to be skipped, not error#2407
hami-robot[bot] merged 1 commit into
Project-HAMi:masterfrom
imantaba:fix/vgpumonitor-shortuuid-test

Conversation

@imantaba

@imantaba imantaba commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

What type of PR is this?

/kind bug

What this PR does / why we need it:

TestCollectContainerMetricsBadInput fails on master, which blocks unit tests for every open PR.

Two recently-merged PRs conflict:

#2350 merged after #2364 but kept the pre-#2364 expectation, so the test now fails deterministically on master.

This aligns the short-UUID case with the actual behavior: the device is skipped, so collectContainer returns no metrics and no error — matching the sibling TestCollectContainerMetricsSkipsInvalidUTF8UUID. Test-only change; no production code touched.

Which issue(s) this PR fixes:

Special notes for your reviewer:

go test ./cmd/vGPUmonitor/ -count=1 passes with this change.

This change was prepared with AI assistance (per CONTRIBUTING.md); all changes were reviewed and verified by me.

Does this PR introduce a user-facing change?:

NONE

Summary by CodeRabbit

  • Bug Fixes
    • Invalid devices with short UUIDs are now skipped cleanly without causing errors or emitting invalid metrics.

@hami-robot hami-robot Bot added kind/bug Something isn't working dco-signoff: yes labels Aug 6, 2026
@hami-robot
hami-robot Bot requested review from DSFans2014 and lengrongfu August 6, 2026 10:15
@github-actions github-actions Bot removed the kind/bug Something isn't working label Aug 6, 2026
@hami-robot hami-robot Bot added the size/S label Aug 6, 2026
@coderabbitai

coderabbitai Bot commented Aug 6, 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: Pro Plus

Run ID: 4b7383c2-0de1-4eb4-91f8-61fbeb0e2c4c

📥 Commits

Reviewing files that changed from the base of the PR and between c35cb50 and 92c7a76.

📒 Files selected for processing (1)
  • cmd/vGPUmonitor/metrics_container_test.go
🚧 Files skipped from review as they are similar to previous changes (1)
  • cmd/vGPUmonitor/metrics_container_test.go

📝 Walkthrough

Walkthrough

The short-UUID test now expects collection to succeed while skipping the invalid device and emitting no metrics.

Changes

Metric collection validation

Layer / File(s) Summary
Short UUID handling test
cmd/vGPUmonitor/metrics_container_test.go
The test checks for no collection error and zero emitted metrics when the device UUID is too short.

Estimated code review effort: 1 (Trivial) | ~2 minutes

Possibly related PRs

Suggested reviewers: lengrongfu, dsfans2014

Poem

A rabbit checks the UUID line,
Finds one too short to fit the sign.
No error thumps, no metrics grow,
The faulty device is skipped below.
Tests now match the collector’s flow.

🚥 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 test change to skip short UUIDs instead of returning an error.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
✨ Finishing Touches
🧪 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 Aug 6, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

Flag Coverage Δ
unittests 63.34% <ø> (+1.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.
see 5 files with indirect coverage changes

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

Comment thread cmd/vGPUmonitor/metrics_container_test.go Outdated
@archlitchi

Copy link
Copy Markdown
Member

yeah, thanks for fixing that, and there's another ut failure here: https://github.com/Project-HAMi/HAMi/actions/runs/31076738697/job/92550580659?pr=2311, perhaps you can solve that too?

Project-HAMi#2364 changed collectContainerMetrics to skip devices whose UUID is
shorter than 40 chars (shared memory not yet initialised) instead of
returning an error, but TestCollectContainerMetricsBadInput from Project-HAMi#2350
still asserted the old error behavior, so it fails on master. Align the
short-UUID case with the actual behavior (skipped, no metrics, no error),
matching the sibling TestCollectContainerMetricsSkipsInvalidUTF8UUID.

Signed-off-by: imantaba <itn.taba@gmail.com>
@imantaba
imantaba force-pushed the fix/vgpumonitor-shortuuid-test branch from 82dbdc8 to 92c7a76 Compare August 6, 2026 10:34
@coderabbitai

coderabbitai Bot commented Aug 6, 2026

Copy link
Copy Markdown

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

@archlitchi archlitchi left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

/lgtm

@hami-robot

hami-robot Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: archlitchi, imantaba

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

The pull request process is described 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

@hami-robot hami-robot Bot added the approved label Aug 6, 2026
@hami-robot
hami-robot Bot merged commit c9b9559 into Project-HAMi:master Aug 6, 2026
17 checks passed
@imantaba

imantaba commented Aug 6, 2026

Copy link
Copy Markdown
Contributor Author

yeah, thanks for fixing that, and there's another ut failure here: https://github.com/Project-HAMi/HAMi/actions/runs/31076738697/job/92550580659?pr=2311, perhaps you can solve that too?

I made a comment there here

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants