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

Function TestVolumePrunePromptNo

cli/command/volume/prune_test.go:162–181  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

160}
161
162func TestVolumePrunePromptNo(t *testing.T) {
163 // FIXME(vdemeester) make it work..
164 skip.If(t, runtime.GOOS == "windows", "TODO: fix test on windows")
165
166 for _, input := range []string{"n", "N", "no", "anything", "really"} {
167 t.Run(input, func(t *testing.T) {
168 cli := test.NewFakeCli(&fakeClient{
169 volumePruneFunc: simplePruneFunc,
170 })
171
172 cli.SetIn(streams.NewIn(io.NopCloser(strings.NewReader(input))))
173 cmd := newPruneCommand(cli)
174 cmd.SetArgs([]string{})
175 cmd.SetOut(io.Discard)
176 cmd.SetErr(io.Discard)
177 assert.ErrorContains(t, cmd.Execute(), "volume prune has been cancelled")
178 golden.Assert(t, cli.OutBuffer().String(), "volume-prune-no.golden")
179 })
180 }
181}
182
183func simplePruneFunc(options client.VolumePruneOptions) (client.VolumePruneResult, error) {
184 return client.VolumePruneResult{

Callers

nothing calls this directly

Calls 7

SetInMethod · 0.95
OutBufferMethod · 0.95
SetArgsMethod · 0.80
newPruneCommandFunction · 0.70
StringMethod · 0.65
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…