test(plugin): fix TestGetNumaNode failure caused by existing PCI bus ID - #2546
Conversation
|
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)
📝 WalkthroughWalkthroughThe absent-NUMA-node test fixture now uses ChangesPCI fixture update
Estimated code review effort: 1 (Trivial) | ~2 minutes Possibly related PRs
Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
🧪 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 |
Signed-off-by: shinigami-777 <chattopadhyaytamaghna@gmail.com>
48a3654 to
6eff773
Compare
Codecov Report✅ All modified and coverable lines are covered by tests.
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
|
/lgtm |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: FouoF, shinigami-777 The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
What type of PR is this?
/kind failing-test
What this PR does / why we need it:
The
TestGetNumaNodetest in register_test.go previously hardcoded the PCI bus ID to be00000000:02:00.0with the assumption that this device would not exist on the test host (and therefore lack a/sys/bus/pci/devices/.../numa_nodefile). However, on machines where a device actually does exist at0000:02:00.0such as local dev environments or specific CI nodes, theGetNumaNodefunction successfully reads the file instead of returning the expected error, causing the test to fail (my own machine had this case and thus the test./pkg/device-plugin/nvidiadevice/nvinternal/plugin/kept failing).Change Made:
pkg/device-plugin/nvidiadevice/nvinternal/plugin/register_test.go:Updated the mockedPciInfo.BusIdin the test from00000000:02:00.0to an impossible bus ID0000DEAD:BE:EF.0.By using
DEAD:BE:EF.0, we can guarantee that the numa_node sysfs path will never exist on any machine regardless of their local hardware setup, ensuring the error branch is deterministically triggered and the test passes consistently .Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer:
AI assistance disclosure:
I saw that
make testwas failing on my machine while doing something and used Gemini Pro 3.1 for investigating some of the recent commits to find the cause. Verified everything manually before creating the PR.Does this PR introduce a user-facing change?:
No, this only modifies a unit test that might fail for some machines.
Summary by CodeRabbit