(t *testing.T)
| 65 | } |
| 66 | |
| 67 | func TestFaultyRunDoubleWait(t *testing.T) { |
| 68 | // Double wait returns an error on the second wait, but also returns the existing result |
| 69 | t.Parallel() |
| 70 | |
| 71 | command := &com.Command{ |
| 72 | Binary: "printf", |
| 73 | Args: []string{"one"}, |
| 74 | Timeout: time.Second, |
| 75 | } |
| 76 | |
| 77 | err := command.Run(context.WithValue(context.Background(), com.LoggerKey, t)) |
| 78 | |
| 79 | assertive.ErrorIsNil(t, err, "Err") |
| 80 | |
| 81 | res, err := command.Wait() |
| 82 | |
| 83 | assertive.ErrorIsNil(t, err, "Err") |
| 84 | assertive.IsEqual(t, expect.ExitCodeSuccess, res.ExitCode, "ExitCode") |
| 85 | assertive.IsEqual(t, "one", res.Stdout, "Stdout") |
| 86 | assertive.IsEqual(t, "", res.Stderr, "Stderr") |
| 87 | |
| 88 | res, err = command.Wait() |
| 89 | |
| 90 | assertive.ErrorIs(t, err, com.ErrExecAlreadyFinished, "Err") |
| 91 | assertive.IsEqual(t, expect.ExitCodeSuccess, res.ExitCode, "ExitCode") |
| 92 | assertive.IsEqual(t, "one", res.Stdout, "Stdout") |
| 93 | assertive.IsEqual(t, "", res.Stderr, "Stderr") |
| 94 | } |
| 95 | |
| 96 | func TestFailRun(t *testing.T) { |
| 97 | t.Parallel() |
nothing calls this directly
no test coverage detected
searching dependent graphs…