MCPcopy Index your code
hub / github.com/docker/cli / TestConfigRemoveContinueAfterError

Function TestConfigRemoveContinueAfterError

cli/command/config/remove_test.go:63–83  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

61}
62
63func TestConfigRemoveContinueAfterError(t *testing.T) {
64 names := []string{"foo", "bar"}
65 var removedConfigs []string
66
67 cli := test.NewFakeCli(&fakeClient{
68 configRemoveFunc: func(_ context.Context, name string, _ client.ConfigRemoveOptions) (client.ConfigRemoveResult, error) {
69 removedConfigs = append(removedConfigs, name)
70 if name == "foo" {
71 return client.ConfigRemoveResult{}, errors.New("error removing config: " + name)
72 }
73 return client.ConfigRemoveResult{}, nil
74 },
75 })
76
77 cmd := newConfigRemoveCommand(cli)
78 cmd.SetArgs(names)
79 cmd.SetOut(io.Discard)
80 cmd.SetErr(io.Discard)
81 assert.Error(t, cmd.Execute(), "error removing config: foo")
82 assert.Check(t, is.DeepEqual(names, removedConfigs))
83}

Callers

nothing calls this directly

Calls 5

newConfigRemoveCommandFunction · 0.85
SetArgsMethod · 0.80
SetOutMethod · 0.45
SetErrMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…