MCPcopy Create free account
hub / github.com/coder/envbox / NewFakeDockerClient

Function NewFakeDockerClient

cli/clitest/fake.go:34–55  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

32}
33
34func NewFakeDockerClient() dockerutil.Client {
35 client := &dockerfake.MockClient{}
36
37 client.ContainerInspectFn = func(_ context.Context, _ string) (dockertypes.ContainerJSON, error) {
38 return dockertypes.ContainerJSON{
39 ContainerJSONBase: &dockertypes.ContainerJSONBase{
40 GraphDriver: dockertypes.GraphDriverData{
41 Data: map[string]string{"MergedDir": "blah"},
42 },
43 },
44 }, nil
45 }
46
47 client.ContainerExecAttachFn = func(_ context.Context, _ string, _ containertypes.ExecAttachOptions) (dockertypes.HijackedResponse, error) {
48 return dockertypes.HijackedResponse{
49 Reader: bufio.NewReader(strings.NewReader("root:x:0:0:root:/root:/bin/bash")),
50 Conn: &net.IPConn{},
51 }, nil
52 }
53
54 return client
55}

Callers 1

NewFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected