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

Function TestRunCopyFromContainerToStdout

cli/command/container/cp_test.go:52–70  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

50}
51
52func TestRunCopyFromContainerToStdout(t *testing.T) {
53 tarContent := "the tar content"
54
55 cli := test.NewFakeCli(&fakeClient{
56 containerCopyFromFunc: func(ctr, srcPath string) (client.CopyFromContainerResult, error) {
57 assert.Check(t, is.Equal("container", ctr))
58 return client.CopyFromContainerResult{
59 Content: io.NopCloser(strings.NewReader(tarContent)),
60 }, nil
61 },
62 })
63 err := runCopy(context.TODO(), cli, copyOptions{
64 source: "container:/path",
65 destination: "-",
66 })
67 assert.NilError(t, err)
68 assert.Check(t, is.Equal(tarContent, cli.OutBuffer().String()))
69 assert.Check(t, is.Equal("", cli.ErrBuffer().String()))
70}
71
72func TestRunCopyFromContainerToFilesystem(t *testing.T) {
73 srcDir := fs.NewDir(t, "cp-test",

Callers

nothing calls this directly

Calls 4

OutBufferMethod · 0.95
ErrBufferMethod · 0.95
runCopyFunction · 0.85
StringMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…