Expand NVIDIA device test coverage - #2340
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: rishisulakhe 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 |
|
Welcome @rishisulakhe! It looks like this is your first PR to Project-HAMi/HAMi 🎉 |
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThe NVIDIA device tests add coverage for request-only resources, container resource mutation defaults, MPS allocation, and NUMA-spanning allocation failures. The opening block-comment delimiter is also corrected. ChangesNVIDIA device behavior tests
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related PRs
Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
98514a0 to
a86ed9e
Compare
a86ed9e to
a6ce9e1
Compare
|
@mesutoezdil This PR is ready for review. Please have a look when you get time. |
| Nums: 1, | ||
| Type: NvidiaGPUDevice, | ||
| Memreq: 2048, | ||
| MemPercentagereq: 101, |
There was a problem hiding this comment.
Ci is failing so run gofmt and make verify and push the fix. Consider adding /kind cleanup to the pr.
this pr has merge conflicts with master. do rebase/merge with master and resolve conflicts.
Also no ai disclosure is present add that also ;).
| Annotations: map[string]string{AllocateMode: "mps"}, | ||
| }} | ||
| fit, result, _ := nv.Fit(devices, req, pod, &device.NodeInfo{}, &device.PodDevices{}) | ||
| assert.Equal(t, true, fit) |
There was a problem hiding this comment.
noticed a tiny inconsistency.. TestFit_NumaSwitching uses assert.Equal(t, fit, true), so consider sticking to tht argument order only. TestFit_MpsMode, TestFit_NumaBindDifferentNumaFails and TestMutateContainerResource make them follow the norm
|
please fix this CI |
Signed-off-by: Rishi Prasad Sulakhe <rishiprasadsulakhe@gmail.com>
a6ce9e1 to
a45a084
Compare
|
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. |
|
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. |
a021e47 to
d38e065
Compare
|
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 failing CI unit test is not related to PR |
|
@rishisulakhe the failing unit test CI was caused by invalid test cases, which have now been fixed. Could you please sync with the latest master and push again? |
|
Thanks for improving test coverage. This PR adds a substantial set of NVIDIA tests without connecting them to a reported defect, a behavior change, or a maintainer-confirmed coverage gap. The current unit-test check is failing, and the branch has not been updated after the maintainer requested a sync. Pure coverage growth is not enough to justify the ongoing review and maintenance cost here, so we are closing this PR. Future tests should accompany a concrete fix or protect an explicitly agreed contract. |
What type of PR is this?
What this PR does / why we need it:
Added test coverage for three functions that were previously untested or under-tested.
mutateContainerResource had zero test coverage despite being called by MutateAdmission on every pod admission. The test covers:
The existing test already had one Requests-fallback case (GPU count only). Added three more cases covering mem, cores, and mem-percentage in Requests-only — confirming that GenerateResourceRequests falls back to Requests for all resource types.
Tests that Fit() succeeds when devices have Mode: "mps" and the pod has the nvidia.com/vgpu-mode: mps annotation. This code path in checkType was previously untested.
Complements the existing TestFit_NumaSwitching (which tests the success case). Verifies that Fit() returns false with reason containing NumaNotFit and AllocatedCardsInsufficientRequest when NumaBind: "true" is set but devices span different NUMA nodes.
Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer:
Does this PR introduce a user-facing change?:
Summary by CodeRabbit