Skip to content

feat: add more prominent failure notice on slogtest error #190

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

Merged
merged 2 commits into from
Sep 1, 2023

Conversation

spikecurtis
Copy link
Contributor

@spikecurtis spikecurtis commented Aug 31, 2023

When looking at test failures on coder/coder it's just not that easy to tell that a failure is due to a dropped error log. The error log gets dropped, the test proceeds, all the require and assert calls pass, but it's marked a failure. The log itself is not very visually distinct with [erro] instead of like [info] being the only distinguishing mark.

If you didn't know that slogtest by default fails tests for logging errors, then you'd probably be hard pressed to understand why the test failed.

This is an attempt to make it more prominent and easy to understand.

Also, for fatal logs, we no longer call tb.Fatal(), which is only allowed in the main test goroutine, and loggers are routinely passed to goroutines. EDIT: reverted this change, since logger.Fatal() calls os.Exit() which can't really be tested. If we hit a Fatal log in the product code, not the test, all bets are probably off anyway...

Signed-off-by: Spike Curtis <spike@coder.com>
@spikecurtis spikecurtis requested review from coadler and ammario August 31, 2023 08:41
Signed-off-by: Spike Curtis <spike@coder.com>
Copy link
Contributor

@coadler coadler left a comment

Choose a reason for hiding this comment

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

This has confused me so many times

@spikecurtis spikecurtis merged commit 3e17d6d into main Sep 1, 2023
@spikecurtis spikecurtis deleted the spike/make-slogtest-errors-more-prominent branch September 1, 2023 04:30
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.

3 participants