mirror of
https://github.com/NVIDIA/nvidia-container-toolkit
synced 2025-06-26 18:18:24 +00:00
fetch current container runtime config through the command line
Signed-off-by: Tariq Ibrahim <tibrahim@nvidia.com> add default runtime binary path to runtimes field of toolkit config toml Signed-off-by: Tariq Ibrahim <tibrahim@nvidia.com> [no-relnote] Get low-level runtimes consistently We ensure that we use the same low-level runtimes regardless of the runtime engine being configured. This ensures consistent behaviour. Signed-off-by: Evan Lezar <elezar@nvidia.com> Co-authored-by: Evan Lezar <elezar@nvidia.com> address review comment Signed-off-by: Tariq Ibrahim <tibrahim@nvidia.com>
This commit is contained in:
@@ -213,3 +213,37 @@ func TestUpdateConfigRuntimes(t *testing.T) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
func TestGetRuntimeConfig(t *testing.T) {
|
||||
c := map[string]interface{}{
|
||||
"runtimes": map[string]interface{}{
|
||||
"nvidia": map[string]interface{}{
|
||||
"path": "nvidia-container-runtime",
|
||||
"args": []string{},
|
||||
},
|
||||
},
|
||||
}
|
||||
cfg := Config(c)
|
||||
|
||||
testCases := []struct {
|
||||
description string
|
||||
runtime string
|
||||
expected string
|
||||
}{
|
||||
{
|
||||
description: "existing runtime",
|
||||
runtime: "nvidia",
|
||||
expected: "nvidia-container-runtime",
|
||||
},
|
||||
{
|
||||
description: "non-existent runtime",
|
||||
runtime: "some-other-runtime",
|
||||
expected: "",
|
||||
},
|
||||
}
|
||||
for _, tc := range testCases {
|
||||
rc, err := cfg.GetRuntimeConfig(tc.runtime)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, tc.expected, rc.GetBinaryPath())
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user