Skip to content

Refactor device node tests#1637

Merged
elezar merged 4 commits intoNVIDIA:mainfrom
elezar:refactor-device-node-tests
Feb 12, 2026
Merged

Refactor device node tests#1637
elezar merged 4 commits intoNVIDIA:mainfrom
elezar:refactor-device-node-tests

Conversation

@elezar
Copy link
Member

@elezar elezar commented Feb 6, 2026

In order to make changes related to device nodes more testable, these changes refactor the way they are discovered in tests to allow for tests to specify mocks used in discovery.

We also replace the logic to check the __NVCT_TESTING_DEVICES_ARE_FILES envvar when discovering device nodes on our test file systems with stubs that can be overridden per test.

This was motivated by #1631 and #630.

@elezar elezar force-pushed the refactor-device-node-tests branch from 187c0b5 to 56cb161 Compare February 6, 2026 16:42
@elezar elezar added this to the v1.19.0 milestone Feb 6, 2026
@elezar elezar force-pushed the refactor-device-node-tests branch from 56cb161 to 4b41e28 Compare February 6, 2026 16:54
@coveralls
Copy link

coveralls commented Feb 6, 2026

Pull Request Test Coverage Report for Build 21762024183

Details

  • 10 of 89 (11.24%) changed or added relevant lines in 4 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.07%) to 39.479%

Changes Missing Coverage Covered Lines Changed/Added Lines %
internal/devices/devices.go 0 19 0.0%
internal/devices/devices_tests.go 0 60 0.0%
Totals Coverage Status
Change from base Build 21761866307: -0.07%
Covered Lines: 5743
Relevant Lines: 14547

💛 - Coveralls

This change adds an internal devices package that allows for
overriding device-node specific function for testing. This
replaces the use of the __NVCT_TESTING_DEVICES_ARE_FILES envvar.

Signed-off-by: Evan Lezar <elezar@nvidia.com>
Signed-off-by: Evan Lezar <elezar@nvidia.com>
Signed-off-by: Evan Lezar <elezar@nvidia.com>
This change is a minor improvemnt -- mostly for testing -- where the
device Path is used to query device information if the HostPath is not
set.

Signed-off-by: Evan Lezar <elezar@nvidia.com>
@elezar elezar force-pushed the refactor-device-node-tests branch from 4b41e28 to d957974 Compare February 6, 2026 18:48
@elezar elezar requested a review from jgehrcke February 7, 2026 16:26
@elezar elezar self-assigned this Feb 10, 2026
@elezar elezar requested a review from klueska February 10, 2026 14:31
Copy link
Collaborator

@jgehrcke jgehrcke left a comment

Choose a reason for hiding this comment

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

to allow for tests to specify mocks used in discovery.

Nice! LGTM

@elezar elezar merged commit 96cbcff into NVIDIA:main Feb 12, 2026
16 checks passed
@elezar elezar deleted the refactor-device-node-tests branch February 12, 2026 19:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants