-
Notifications
You must be signed in to change notification settings - Fork 100
feat: add gotest-junit tester #730
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the intention to export these? Do we expect things outside this command to use them/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.