MCPcopy Index your code
hub / github.com/docker/cli / TestRunCommitClientError

Function TestRunCommitClientError

cli/command/container/commit_test.go:46–62  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

44}
45
46func TestRunCommitClientError(t *testing.T) {
47 clientError := errors.New("client error")
48
49 cli := test.NewFakeCli(&fakeClient{
50 containerCommitFunc: func(ctx context.Context, ctr string, options client.ContainerCommitOptions) (client.ContainerCommitResult, error) {
51 return client.ContainerCommitResult{}, clientError
52 },
53 })
54
55 cmd := newCommitCommand(cli)
56 cmd.SetOut(io.Discard)
57 cmd.SetErr(io.Discard)
58 cmd.SetArgs([]string{"container-id"})
59
60 err := cmd.Execute()
61 assert.ErrorIs(t, err, clientError)
62}

Callers

nothing calls this directly

Calls 4

newCommitCommandFunction · 0.85
SetArgsMethod · 0.80
SetOutMethod · 0.45
SetErrMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…