github.1git.de/docker/cli@v26.1.3+incompatible/cli/command/builder/prune_test.go (about)

     1  package builder
     2  
     3  import (
     4  	"context"
     5  	"errors"
     6  	"testing"
     7  
     8  	"github.com/docker/cli/internal/test"
     9  	"github.com/docker/docker/api/types"
    10  )
    11  
    12  func TestBuilderPromptTermination(t *testing.T) {
    13  	ctx, cancel := context.WithCancel(context.Background())
    14  	t.Cleanup(cancel)
    15  
    16  	cli := test.NewFakeCli(&fakeClient{
    17  		builderPruneFunc: func(ctx context.Context, opts types.BuildCachePruneOptions) (*types.BuildCachePruneReport, error) {
    18  			return nil, errors.New("fakeClient builderPruneFunc should not be called")
    19  		},
    20  	})
    21  	cmd := NewPruneCommand(cli)
    22  	test.TerminatePrompt(ctx, t, cmd, cli)
    23  }