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

Function TestVolumeRemoveErrors

cli/command/volume/remove_test.go:12–39  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

10)
11
12func TestVolumeRemoveErrors(t *testing.T) {
13 testCases := []struct {
14 args []string
15 volumeRemoveFunc func(volumeID string, force bool) error
16 expectedError string
17 }{
18 {
19 expectedError: "requires at least 1 argument",
20 },
21 {
22 args: []string{"nodeID"},
23 volumeRemoveFunc: func(volumeID string, force bool) error {
24 return errors.New("error removing the volume")
25 },
26 expectedError: "error removing the volume",
27 },
28 }
29 for _, tc := range testCases {
30 cmd := newRemoveCommand(
31 test.NewFakeCli(&fakeClient{
32 volumeRemoveFunc: tc.volumeRemoveFunc,
33 }))
34 cmd.SetArgs(tc.args)
35 cmd.SetOut(io.Discard)
36 cmd.SetErr(io.Discard)
37 assert.ErrorContains(t, cmd.Execute(), tc.expectedError)
38 }
39}
40
41func TestNodeRemoveMultiple(t *testing.T) {
42 cmd := newRemoveCommand(test.NewFakeCli(&fakeClient{}))

Callers

nothing calls this directly

Calls 4

SetArgsMethod · 0.80
newRemoveCommandFunction · 0.70
SetOutMethod · 0.45
SetErrMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…