Conversation
This tester executes Go tests such as `neuron.test` and `nvidia.test` in a similar fashion to `kubetest2-tester-exec`, but with the added benefit of outputting a JUnit XML file consistent with the `ginkgov1` tester. Signed-off-by: Patrick J.P. Culp <jpculp@amazon.com>
| This tester executes a Go test binary and generates JUnit XML output. | ||
| ` | ||
|
|
||
| func (t *Tester) Execute() error { |
There was a problem hiding this comment.
Is the intention to export these? Do we expect things outside this command to use them/
There was a problem hiding this comment.
I don't think so, but it's consistent with the ginkgov1 code.
| signals := make(chan os.Signal, 5) | ||
| signal.Notify(signals) | ||
| defer signal.Stop(signals) |
There was a problem hiding this comment.
Is there a reason we are doing this with channels and having to manage signal handling vs just waiting on the binary in the main thread?
There was a problem hiding this comment.
We could probably just simplify it to testErr := cmd.Run(), but the current implementation is more consistent with the upstream kubetest2 exec.go.
| signals := make(chan os.Signal, 5) | ||
| signal.Notify(signals) | ||
| defer signal.Stop(signals) |
There was a problem hiding this comment.
We could probably just simplify it to testErr := cmd.Run(), but the current implementation is more consistent with the upstream kubetest2 exec.go.
| cmd.Stdout = io.MultiWriter(os.Stdout, &buf) | ||
| cmd.Stderr = io.MultiWriter(os.Stderr, &buf) |
There was a problem hiding this comment.
| cmd.Stdout = io.MultiWriter(os.Stdout, &buf) | |
| cmd.Stderr = io.MultiWriter(os.Stderr, &buf) | |
| // ensure we also capture output | |
| var systemout bytes.Buffer | |
| syncSystemOut := &mutexWriter{ | |
| writer: &systemout, | |
| } | |
| cmd.Stdout = io.MultiWriter(syncSystemOut, os.Stdout) | |
| cmd.Stderr = io.MultiWriter(syncSystemOut, os.Stderr) |
I wonder if we should add this to be more consistent with upstream kubetest2's junitexec.go.
| This tester executes a Go test binary and generates JUnit XML output. | ||
| ` | ||
|
|
||
| func (t *Tester) Execute() error { |
There was a problem hiding this comment.
I don't think so, but it's consistent with the ginkgov1 code.
|
Dropping to draft while I work on attribution block(s). |
Description of changes:
This tester executes Go tests such as
neuron.testandnvidia.testin a similar fashion tokubetest2-tester-exec, but with the added benefit of outputting a JUnit XML file consistent with theginkgov1tester.Testing of changes:
Ran the
neuron.testusing thegotest-junittester.Console output
JUnit XML output
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.