Add unit test for gpuPodSpecFilter container resource-list branch#2659
Merged
abrarshivani merged 1 commit intoJul 24, 2026
Merged
Conversation
abrarshivani
force-pushed
the
unit-test-cmd-gpu-operator
branch
from
July 23, 2026 19:38
5e4652a to
c9b4a5a
Compare
abrarshivani
marked this pull request as ready for review
July 23, 2026 20:06
abrarshivani
requested review from
cdesiniotis,
karthikvetrivel,
rahulait,
rajathagasthya,
shivamerla and
tariq1890
as code owners
July 23, 2026 20:06
Contributor
|
Can you rebase this PR? |
abrarshivani
force-pushed
the
unit-test-cmd-gpu-operator
branch
from
July 24, 2026 19:18
c9b4a5a to
0486a01
Compare
abrarshivani
force-pushed
the
unit-test-cmd-gpu-operator
branch
from
July 24, 2026 19:31
0486a01 to
7abcc59
Compare
Contributor
Author
|
@tariq1890 I've rebased the branch. Can you please take another look? |
tariq1890
reviewed
Jul 24, 2026
tariq1890
reviewed
Jul 24, 2026
abrarshivani
force-pushed
the
unit-test-cmd-gpu-operator
branch
from
July 24, 2026 20:44
7abcc59 to
6ebded8
Compare
tariq1890
reviewed
Jul 24, 2026
tariq1890
approved these changes
Jul 24, 2026
The existing TestGPUPodSpecFilterResourceClaims covers only the DRA/ ResourceClaims branch of gpuPodSpecFilter, leaving the container resource-list branch (nvidia.com/gpu and nvidia.com/mig- in a container's limits/requests, and the Running/Pending phase gate) untested. Add TestGPUPodSpecFilterResourceList to cover it, bringing gpuPodSpecFilter to 100% statement coverage. Signed-off-by: Abrar Shivani <ashivani@nvidia.com>
abrarshivani
force-pushed
the
unit-test-cmd-gpu-operator
branch
from
July 24, 2026 21:47
6ebded8 to
d63c96a
Compare
abrarshivani
enabled auto-merge
July 24, 2026 22:19
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
gpuPodSpecFilterdecides whether a pod is a GPU pod via two branches:nvidia.com/gpu*ornvidia.com/mig-*in itslimits/requests(gated on the pod beingRunning/Pending), andPodHasNVIDIAGPUClaim(...).The existing
TestGPUPodSpecFilterResourceClaimscovers only branch (2). Per the coverage report, branch (1) — thenvidia.com/gpu/nvidia.com/mig-prefix match and the container-loopreturn true— was uncovered.This PR adds
TestGPUPodSpecFilterResourceListtocmd/gpu-operator/main_test.gocovering branch (1):nvidia.com/gpuin a container'slimitsand inrequestsnvidia.com/mig-prefixSucceededpod with a GPU resource is ignored)The pods carry no
ResourceClaims, so the DRA branch resolves tofalseand only the resource-list branch is exercised. This complements the existing DRA test rather than duplicating it, bringinggpuPodSpecFilterto 100% statement coverage.Tests only — no production changes.
Checklist
make lint)make validate-generated-assets)make validate-modules)Testing