MCPcopy Create free account
hub / github.com/docker/cli / TestSecretRemoveContinueAfterError

Function TestSecretRemoveContinueAfterError

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

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 5

newSecretRemoveCommandFunction · 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…