MCPcopy
hub / github.com/nektos/act / TestDockerExecFailure

Function TestDockerExecFailure

pkg/container/docker_run_test.go:147–177  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

145}
146
147func TestDockerExecFailure(t *testing.T) {
148 ctx := context.Background()
149
150 conn := &mockConn{}
151
152 cli := &mockDockerClient{}
153 cli.On("ExecCreate", ctx, "123", mock.AnythingOfType("client.ExecCreateOptions")).Return(client.ExecCreateResult{ID: "id"}, nil)
154 cli.On("ExecAttach", ctx, "id", mock.AnythingOfType("client.ExecAttachOptions")).Return(client.ExecAttachResult{
155 HijackedResponse: client.HijackedResponse{
156 Conn: conn,
157 Reader: bufio.NewReader(strings.NewReader("output")),
158 },
159 }, nil)
160 cli.On("ExecInspect", ctx, "id", mock.AnythingOfType("client.ExecInspectOptions")).Return(client.ExecInspectResult{
161 ExitCode: 1,
162 }, nil)
163
164 cr := &containerReference{
165 id: "123",
166 cli: cli,
167 input: &NewContainerInput{
168 Image: "image",
169 },
170 }
171
172 err := cr.exec([]string{""}, map[string]string{}, "user", "workdir")(ctx)
173 assert.Error(t, err, "exit with `FAILURE`: 1")
174
175 conn.AssertExpectations(t)
176 cli.AssertExpectations(t)
177}
178
179func TestDockerCopyTarStream(t *testing.T) {
180 ctx := context.Background()

Callers

nothing calls this directly

Calls 3

execMethod · 0.95
OnMethod · 0.80
ErrorMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…