(t *testing.T)
| 221 | } |
| 222 | |
| 223 | func 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 | |
| 258 | func TestNewExecCommandErrors(t *testing.T) { |
| 259 | testCases := []struct { |
nothing calls this directly
no test coverage detected
searching dependent graphs…