28 lines
692 B
Go
28 lines
692 B
Go
package container
|
|
|
|
import (
|
|
"context"
|
|
"errors"
|
|
"io"
|
|
"testing"
|
|
|
|
"github.com/docker/cli/internal/test"
|
|
"github.com/moby/moby/client"
|
|
)
|
|
|
|
func TestContainerPrunePromptTermination(t *testing.T) {
|
|
ctx, cancel := context.WithCancel(context.Background())
|
|
t.Cleanup(cancel)
|
|
|
|
cli := test.NewFakeCli(&fakeClient{
|
|
containerPruneFunc: func(ctx context.Context, opts client.ContainerPruneOptions) (client.ContainerPruneResult, error) {
|
|
return client.ContainerPruneResult{}, errors.New("fakeClient containerPruneFunc should not be called")
|
|
},
|
|
})
|
|
cmd := newPruneCommand(cli)
|
|
cmd.SetArgs([]string{})
|
|
cmd.SetOut(io.Discard)
|
|
cmd.SetErr(io.Discard)
|
|
test.TerminatePrompt(ctx, t, cmd, cli)
|
|
}
|