2024-02-21 10:36:17 -05:00
|
|
|
package network
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/docker/cli/internal/test"
|
|
|
|
"github.com/docker/docker/api/types/filters"
|
2024-06-06 20:31:09 -04:00
|
|
|
"github.com/docker/docker/api/types/network"
|
2024-02-21 10:36:17 -05:00
|
|
|
"github.com/pkg/errors"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestNetworkPrunePromptTermination(t *testing.T) {
|
|
|
|
ctx, cancel := context.WithCancel(context.Background())
|
|
|
|
t.Cleanup(cancel)
|
|
|
|
|
|
|
|
cli := test.NewFakeCli(&fakeClient{
|
2024-06-06 20:31:09 -04:00
|
|
|
networkPruneFunc: func(ctx context.Context, pruneFilters filters.Args) (network.PruneReport, error) {
|
|
|
|
return network.PruneReport{}, errors.New("fakeClient networkPruneFunc should not be called")
|
2024-02-21 10:36:17 -05:00
|
|
|
},
|
|
|
|
})
|
|
|
|
cmd := NewPruneCommand(cli)
|
2024-03-12 07:38:47 -04:00
|
|
|
test.TerminatePrompt(ctx, t, cmd, cli)
|
2024-02-21 10:36:17 -05:00
|
|
|
}
|