MCPcopy
hub / github.com/kubernetes/test-infra / TestPerformArgDeletions

Function TestPerformArgDeletions

releng/config-forker/pkg/forker_test.go:202–253  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

200}
201
202func TestPerformArgDeletions(t *testing.T) {
203 t.Parallel()
204
205 tests := []struct {
206 name string
207 args map[string]string
208 deletions string
209 expected map[string]string
210 }{
211 {
212 name: "nil arguments remain nil",
213 args: nil,
214 deletions: "",
215 expected: nil,
216 },
217 {
218 name: "empty arguments remain empty",
219 args: map[string]string{},
220 deletions: "",
221 expected: map[string]string{},
222 },
223 {
224 name: "empty deletions do nothing",
225 args: map[string]string{"foo": "bar"},
226 deletions: "",
227 expected: map[string]string{"foo": "bar"},
228 },
229 {
230 name: "simple deletion works",
231 args: map[string]string{"foo": "bar", "baz": "baz2"},
232 deletions: "foo",
233 expected: map[string]string{"baz": "baz2"},
234 },
235 {
236 name: "multiple deletions work",
237 args: map[string]string{"foo": "bar", "baz": "baz2", "hello": "world"},
238 deletions: "foo, baz",
239 expected: map[string]string{"hello": "world"},
240 },
241 }
242
243 for _, test := range tests {
244 t.Run(test.name, func(t *testing.T) {
245 t.Parallel()
246
247 result := performDeletion(test.args, test.deletions)
248 if !reflect.DeepEqual(result, test.expected) {
249 t.Errorf("Expected result %v, but got %v instead", test.expected, result)
250 }
251 })
252 }
253}
254
255func TestFixImage(t *testing.T) {
256 t.Parallel()

Callers

nothing calls this directly

Calls 2

performDeletionFunction · 0.85
RunMethod · 0.65

Tested by

no test coverage detected