This patch deprecates exported container commands and moves the implementation details to an unexported function. Commands that are affected include: - container.NewRunCommand - container.NewExecCommand - container.NewPsCommand - container.NewContainerCommand - container.NewAttachCommand - container.NewCommitCommand - container.NewCopyCommand - container.NewCreateCommand - container.NewDiffCommand - container.NewExportCommand - container.NewKillCommand - container.NewLogsCommand - container.NewPauseCommand - container.NewPortCommand - container.NewRenameCommand - container.NewRestartCommand - container.NewRmCommand - container.NewStartCommand - container.NewStatsCommand - container.NewStopCommand - container.NewTopCommand - container.NewUnpauseCommand - container.NewUpdateCommand - container.NewWaitCommand - container.NewPruneCommand Signed-off-by: Alano Terblanche <18033717+Benehiko@users.noreply.github.com>
29 lines
727 B
Go
29 lines
727 B
Go
package container
|
|
|
|
import (
|
|
"context"
|
|
"errors"
|
|
"io"
|
|
"testing"
|
|
|
|
"github.com/docker/cli/internal/test"
|
|
"github.com/moby/moby/api/types/container"
|
|
"github.com/moby/moby/api/types/filters"
|
|
)
|
|
|
|
func TestContainerPrunePromptTermination(t *testing.T) {
|
|
ctx, cancel := context.WithCancel(context.Background())
|
|
t.Cleanup(cancel)
|
|
|
|
cli := test.NewFakeCli(&fakeClient{
|
|
containerPruneFunc: func(ctx context.Context, pruneFilters filters.Args) (container.PruneReport, error) {
|
|
return container.PruneReport{}, 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)
|
|
}
|