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

Function TestGetExecExitStatus

cli/command/container/exec_test.go:223–256  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

221}
222
223func TestGetExecExitStatus(t *testing.T) {
224 execID := "the exec id"
225 expectedErr := errors.New("unexpected error")
226
227 testcases := []struct {
228 inspectError error
229 exitCode int
230 expectedError error
231 }{
232 {
233 inspectError: nil,
234 exitCode: 0,
235 },
236 {
237 inspectError: expectedErr,
238 expectedError: expectedErr,
239 },
240 {
241 exitCode: 15,
242 expectedError: cli.StatusError{StatusCode: 15},
243 },
244 }
245
246 for _, testcase := range testcases {
247 apiClient := &fakeClient{
248 execInspectFunc: func(id string) (client.ExecInspectResult, error) {
249 assert.Check(t, is.Equal(execID, id))
250 return client.ExecInspectResult{ExitCode: testcase.exitCode}, testcase.inspectError
251 },
252 }
253 err := getExecExitStatus(context.Background(), apiClient, execID)
254 assert.Check(t, is.Equal(testcase.expectedError, err))
255 }
256}
257
258func TestNewExecCommandErrors(t *testing.T) {
259 testCases := []struct {

Callers

nothing calls this directly

Calls 1

getExecExitStatusFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…