@@ -19,7 +19,6 @@ package modifier
19
19
import (
20
20
"testing"
21
21
22
- "github.com/opencontainers/runtime-spec/specs-go"
23
22
testlog "github.com/sirupsen/logrus/hooks/test"
24
23
"github.com/stretchr/testify/require"
25
24
@@ -74,66 +73,3 @@ func TestNewCSVModifier(t *testing.T) {
74
73
})
75
74
}
76
75
}
77
-
78
- func TestCSVModifierRemovesHook (t * testing.T ) {
79
- logger , _ := testlog .NewNullLogger ()
80
-
81
- testCases := []struct {
82
- description string
83
- spec * specs.Spec
84
- expectedError error
85
- expectedSpec * specs.Spec
86
- }{
87
- {
88
- description : "modification removes existing nvidia-container-runtime-hook" ,
89
- spec : & specs.Spec {
90
- Hooks : & specs.Hooks {
91
- Prestart : []specs.Hook {
92
- {
93
- Path : "/path/to/nvidia-container-runtime-hook" ,
94
- Args : []string {"/path/to/nvidia-container-runtime-hook" , "prestart" },
95
- },
96
- },
97
- },
98
- },
99
- expectedSpec : & specs.Spec {
100
- Hooks : & specs.Hooks {
101
- Prestart : []specs.Hook {},
102
- },
103
- },
104
- },
105
- {
106
- description : "modification removes existing nvidia-container-toolkit" ,
107
- spec : & specs.Spec {
108
- Hooks : & specs.Hooks {
109
- Prestart : []specs.Hook {
110
- {
111
- Path : "/path/to/nvidia-container-toolkit" ,
112
- Args : []string {"/path/to/nvidia-container-toolkit" , "prestart" },
113
- },
114
- },
115
- },
116
- },
117
- expectedSpec : & specs.Spec {
118
- Hooks : & specs.Hooks {
119
- Prestart : []specs.Hook {},
120
- },
121
- },
122
- },
123
- }
124
-
125
- for _ , tc := range testCases {
126
- t .Run (tc .description , func (t * testing.T ) {
127
- m := nvidiaContainerRuntimeHookRemover {logger : logger }
128
-
129
- err := m .Modify (tc .spec )
130
- if tc .expectedError != nil {
131
- require .Error (t , err )
132
- } else {
133
- require .NoError (t , err )
134
- }
135
-
136
- require .Empty (t , tc .spec .Hooks .Prestart )
137
- })
138
- }
139
- }
0 commit comments