theExitStatusIs checks that the exit status of ec command line is 0 (success), and logs profusely in case of it being != 0
(ctx context.Context, expected int)
| 428 | // theExitStatusIs checks that the exit status of ec command line is 0 |
| 429 | // (success), and logs profusely in case of it being != 0 |
| 430 | func theExitStatusIs(ctx context.Context, expected int) error { |
| 431 | status, err := ecStatusFrom(ctx) |
| 432 | if err != nil { |
| 433 | return err |
| 434 | } |
| 435 | |
| 436 | // if the error is an exec.ExitError we need to assert the status to |
| 437 | // be expected below and not fail here |
| 438 | var exitErr *exec.ExitError |
| 439 | if status.err != nil && !errors.As(status.err, &exitErr) { |
| 440 | return fmt.Errorf("failed to invoke the ec command: %#v", status.err) |
| 441 | } |
| 442 | |
| 443 | if status.Cmd.ProcessState.ExitCode() != expected { |
| 444 | return fmt.Errorf("ec exited with %d", status.ProcessState.ExitCode()) |
| 445 | } |
| 446 | |
| 447 | return nil |
| 448 | } |
| 449 | |
| 450 | // theStandardOutputShouldContain looks at the standard output (stdout) of the last invoked ec |
| 451 | // command and compares the expected output with the resulted output. Special handling is done |
nothing calls this directly
no test coverage detected