| 32 | } |
| 33 | |
| 34 | func 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 | } |