mirror of
https://github.com/NVIDIA/nvidia-container-toolkit
synced 2025-04-05 04:59:18 +00:00
[no-relnote] Allow relative paths from operator structs
Signed-off-by: Evan Lezar <elezar@nvidia.com>
This commit is contained in:
parent
a72050442e
commit
ed9310dc37
@ -20,8 +20,6 @@ import "path/filepath"
|
|||||||
|
|
||||||
const (
|
const (
|
||||||
defaultRuntimeName = "nvidia"
|
defaultRuntimeName = "nvidia"
|
||||||
|
|
||||||
defaultRoot = "/usr/bin"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// Runtime defines a runtime to be configured.
|
// Runtime defines a runtime to be configured.
|
||||||
@ -48,9 +46,6 @@ func GetRuntimes(opts ...Option) Runtimes {
|
|||||||
opt(c)
|
opt(c)
|
||||||
}
|
}
|
||||||
|
|
||||||
if c.root == "" {
|
|
||||||
c.root = defaultRoot
|
|
||||||
}
|
|
||||||
if c.nvidiaRuntimeName == "" {
|
if c.nvidiaRuntimeName == "" {
|
||||||
c.nvidiaRuntimeName = defaultRuntimeName
|
c.nvidiaRuntimeName = defaultRuntimeName
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,6 @@ func TestOptions(t *testing.T) {
|
|||||||
testCases := []struct {
|
testCases := []struct {
|
||||||
setAsDefault bool
|
setAsDefault bool
|
||||||
nvidiaRuntimeName string
|
nvidiaRuntimeName string
|
||||||
root string
|
|
||||||
expectedDefaultRuntime string
|
expectedDefaultRuntime string
|
||||||
expectedRuntimes Runtimes
|
expectedRuntimes Runtimes
|
||||||
}{
|
}{
|
||||||
@ -131,7 +130,7 @@ func TestOptions(t *testing.T) {
|
|||||||
runtimes := GetRuntimes(
|
runtimes := GetRuntimes(
|
||||||
WithNvidiaRuntimeName(tc.nvidiaRuntimeName),
|
WithNvidiaRuntimeName(tc.nvidiaRuntimeName),
|
||||||
WithSetAsDefault(tc.setAsDefault),
|
WithSetAsDefault(tc.setAsDefault),
|
||||||
WithRoot(tc.root),
|
WithRoot("/usr/bin"),
|
||||||
)
|
)
|
||||||
|
|
||||||
require.EqualValues(t, tc.expectedRuntimes, runtimes)
|
require.EqualValues(t, tc.expectedRuntimes, runtimes)
|
||||||
|
Loading…
Reference in New Issue
Block a user