hashicorp / hashicorp/nomad-device-nvidia

Add Device interface for testing

Open
#94 0 comments 0 reactions 0 assignees View on GitHub
enhancement hcc/jira stage/accepted
Dominant language
Go
Stars
35
Forks
18
Avg merge
1d 15h
Merged PRs (30d)
8

Description

The NVML driver logic has grown more complex as users have started using this driver for fingerprinting/reserving various types of Nvidia devices. It's reasonable to assume this logic should have basic unit tests. However, in it's current form, its quite difficult to test this logic. Only the `nvmlClient` is testable.

We should refactor the driver logic to make it easier for our community members to unit test their contributions.

This is up for debate but one way to do this would be to move away from using the package function where possible, and use `nvml.DeviceGetHandleByUUID` to get a handle to the device, which is an interface that can be mocked.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by tracing the NVML driver logic around the currently testable nvmlClient and the package functions used for device lookup. Evaluate introducing a mockable Device interface around nvml.DeviceGetHandleByUUID, then add unit tests showing that fingerprinting and device-reservation logic can run without real NVML hardware.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
infrastructure
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.