This patch deprecates exported network commands and moves the
implementation details to an unexported function.
Commands that are affected include:
- network.NewNetworkCommand
- network.NewPruneCommand
Signed-off-by: Alano Terblanche <18033717+Benehiko@users.noreply.github.com>
(cherry picked from commit 78a8856c14)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
29 lines
721 B
Go
29 lines
721 B
Go
package network
|
|
|
|
import (
|
|
"context"
|
|
"errors"
|
|
"io"
|
|
"testing"
|
|
|
|
"github.com/docker/cli/internal/test"
|
|
"github.com/docker/docker/api/types/filters"
|
|
"github.com/docker/docker/api/types/network"
|
|
)
|
|
|
|
func TestNetworkPrunePromptTermination(t *testing.T) {
|
|
ctx, cancel := context.WithCancel(context.Background())
|
|
t.Cleanup(cancel)
|
|
|
|
cli := test.NewFakeCli(&fakeClient{
|
|
networkPruneFunc: func(ctx context.Context, pruneFilters filters.Args) (network.PruneReport, error) {
|
|
return network.PruneReport{}, errors.New("fakeClient networkPruneFunc should not be called")
|
|
},
|
|
})
|
|
cmd := newPruneCommand(cli)
|
|
cmd.SetArgs([]string{})
|
|
cmd.SetOut(io.Discard)
|
|
cmd.SetErr(io.Discard)
|
|
test.TerminatePrompt(ctx, t, cmd, cli)
|
|
}
|