(t *testing.T)
| 160 | } |
| 161 | |
| 162 | func 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 | |
| 183 | func simplePruneFunc(options client.VolumePruneOptions) (client.VolumePruneResult, error) { |
| 184 | return client.VolumePruneResult{ |
nothing calls this directly
no test coverage detected
searching dependent graphs…