mirror of
https://github.com/NVIDIA/nvidia-container-toolkit
synced 2025-02-22 20:29:34 +00:00
[no-relnote] Remove duplicate test case
Signed-off-by: Evan Lezar <elezar@nvidia.com>
This commit is contained in:
parent
b170a35328
commit
6da7af8dfa
@ -19,7 +19,6 @@ package modifier
|
|||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/opencontainers/runtime-spec/specs-go"
|
|
||||||
testlog "github.com/sirupsen/logrus/hooks/test"
|
testlog "github.com/sirupsen/logrus/hooks/test"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|
||||||
@ -74,66 +73,3 @@ func TestNewCSVModifier(t *testing.T) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestCSVModifierRemovesHook(t *testing.T) {
|
|
||||||
logger, _ := testlog.NewNullLogger()
|
|
||||||
|
|
||||||
testCases := []struct {
|
|
||||||
description string
|
|
||||||
spec *specs.Spec
|
|
||||||
expectedError error
|
|
||||||
expectedSpec *specs.Spec
|
|
||||||
}{
|
|
||||||
{
|
|
||||||
description: "modification removes existing nvidia-container-runtime-hook",
|
|
||||||
spec: &specs.Spec{
|
|
||||||
Hooks: &specs.Hooks{
|
|
||||||
Prestart: []specs.Hook{
|
|
||||||
{
|
|
||||||
Path: "/path/to/nvidia-container-runtime-hook",
|
|
||||||
Args: []string{"/path/to/nvidia-container-runtime-hook", "prestart"},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
expectedSpec: &specs.Spec{
|
|
||||||
Hooks: &specs.Hooks{
|
|
||||||
Prestart: []specs.Hook{},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
description: "modification removes existing nvidia-container-toolkit",
|
|
||||||
spec: &specs.Spec{
|
|
||||||
Hooks: &specs.Hooks{
|
|
||||||
Prestart: []specs.Hook{
|
|
||||||
{
|
|
||||||
Path: "/path/to/nvidia-container-toolkit",
|
|
||||||
Args: []string{"/path/to/nvidia-container-toolkit", "prestart"},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
expectedSpec: &specs.Spec{
|
|
||||||
Hooks: &specs.Hooks{
|
|
||||||
Prestart: []specs.Hook{},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
for _, tc := range testCases {
|
|
||||||
t.Run(tc.description, func(t *testing.T) {
|
|
||||||
m := nvidiaContainerRuntimeHookRemover{logger: logger}
|
|
||||||
|
|
||||||
err := m.Modify(tc.spec)
|
|
||||||
if tc.expectedError != nil {
|
|
||||||
require.Error(t, err)
|
|
||||||
} else {
|
|
||||||
require.NoError(t, err)
|
|
||||||
}
|
|
||||||
|
|
||||||
require.Empty(t, tc.spec.Hooks.Prestart)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
Loading…
Reference in New Issue
Block a user