Skip to content

test: improve nvidia device.go UT coverage to 98.5%#1757

Merged
hami-robot[bot] merged 7 commits into
Project-HAMi:masterfrom
kenwoodjw:feat/improve-nvidia-device-test-coverage
Apr 17, 2026
Merged

test: improve nvidia device.go UT coverage to 98.5%#1757
hami-robot[bot] merged 7 commits into
Project-HAMi:masterfrom
kenwoodjw:feat/improve-nvidia-device-test-coverage

Conversation

@kenwoodjw

Copy link
Copy Markdown
Contributor

Assisted-by: Claude:claude-opus-4-6

What type of PR is this?

/kind cleanup

What this PR does / why we need it:

Improve unit test coverage for pkg/device/nvidia/device.go from 31.58% to 98.5% (467/474 statements).

Added tests for:

  • K8s client-dependent functions (NodeCleanUp, LockNode, ReleaseNodeLock) using fake clientset
  • MutateAdmission with priority and runtimeClassName scenarios
  • GetNodeDevices with MIG templates and pair scores
  • Scoring, topology, NUMA-aware scheduling paths
  • CustomFilterRule, GenerateResourceRequests, CheckHealth
  • Combination and pair score computation functions

Which issue(s) this PR fixes:
Related to #569

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

Signed-off-by: kenwoodjw <blackxin55+@gmail.com>
Assisted-by: Claude:claude-opus-4-6
@hami-robot

hami-robot Bot commented Apr 15, 2026

Copy link
Copy Markdown
Contributor

Welcome @kenwoodjw! It looks like this is your first PR to Project-HAMi/HAMi 🎉

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request primarily focuses on enhancing the test coverage for the NVIDIA device implementation and updating project dependencies. The changes in go.mod and go.sum involve updating various Kubernetes and Go standard library sub-repositories while removing unused dependencies. The bulk of the PR adds a comprehensive suite of unit tests to pkg/device/nvidia/device_test.go, covering critical logic such as resource request generation, health monitoring, MIG (Multi-Instance GPU) configuration, node locking mechanisms, and scheduling algorithms including NUMA and topology-aware placement. I have no feedback to provide as there were no review comments to assess.

@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

Comment thread pkg/device/nvidia/device_test.go Outdated
Signed-off-by: kenwoodjw <blackxin55+@gmail.com>
@hami-robot hami-robot Bot removed the lgtm label Apr 17, 2026
Signed-off-by: kenwoodjw <blackxin55+@gmail.com>
Assisted-by: Claude:claude-opus-4-6
Signed-off-by: kenwoodjw <blackxin55+@gmail.com>
Signed-off-by: kenwoodjw <blackxin55+@gmail.com>

@Shouren Shouren 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 added the lgtm label Apr 17, 2026
@hami-robot

hami-robot Bot commented Apr 17, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: archlitchi, kenwoodjw, Shouren

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 merged commit ffddc4e into Project-HAMi:master Apr 17, 2026
6 checks passed
mesutoezdil pushed a commit to mesutoezdil/HAMi that referenced this pull request Jun 14, 2026
* test: improve nvidia device.go UT coverage to 98.5%

Signed-off-by: kenwoodjw <blackxin55+@gmail.com>
Assisted-by: Claude:claude-opus-4-6

* fix lint

Signed-off-by: kenwoodjw <blackxin55+@gmail.com>

* test: improve nvidia device.go UT coverage to 98.5%

Signed-off-by: kenwoodjw <blackxin55+@gmail.com>
Assisted-by: Claude:claude-opus-4-6

* fix lint

Signed-off-by: kenwoodjw <blackxin55+@gmail.com>

* update go sum

Signed-off-by: kenwoodjw <blackxin55+@gmail.com>

---------

Signed-off-by: kenwoodjw <blackxin55+@gmail.com>
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.

3 participants