Skip to content
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

Output logs when failures happen but not in a test #104

Merged
merged 3 commits into from
Aug 4, 2023

Conversation

tateexon
Copy link
Collaborator

@tateexon tateexon commented Aug 3, 2023

There is a corner case in go test results where the test run can fail but there are no test specified failures in the logs. We don't have a great way to pull out what caused it so in this case we just print out all the output.

@tateexon tateexon force-pushed the handle_go_test_failure_with_no_failed_tests branch from 0a5e632 to a325e60 Compare August 3, 2023 22:51
@tateexon tateexon force-pushed the handle_go_test_failure_with_no_failed_tests branch from a325e60 to bb58e66 Compare August 3, 2023 22:53
@tateexon tateexon marked this pull request as ready for review August 3, 2023 22:54
testResults.filter(testResult => {
if (testResult.Action === 'fail') {
if (testResult.Test) {
names.push(testResult.Test)
} else {
// we got a failure without a test failure
packageFailure = true

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tateexon I'm wondering if this case is expected and if we'll always fall through to this case?

When I was reviewing the output for the flakey test runner I put together, I had to handle both cases because:

  • if a test fails, you'll always get output saying the package failed
  • a package could fail without a test failing (eg. in the case of the test spinning off a goroutine and panicing -- go can't trace the goroutine back to its originating test so just fails the package IIRC).

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think my comment is the problem here, will update the comment to make more sense.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment in code has been updated to make more sense.

@tateexon tateexon force-pushed the handle_go_test_failure_with_no_failed_tests branch from b7bb85a to 9ccb362 Compare August 4, 2023 14:10
@tateexon tateexon merged commit 9a48ff0 into main Aug 4, 2023
6 checks passed
@tateexon tateexon deleted the handle_go_test_failure_with_no_failed_tests branch August 4, 2023 15:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants