feat: add more prominent failure notice on slogtest error #190
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
andassert
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 callEDIT: reverted this change, since logger.Fatal() calls os.Exit() which can't really be tested. If we hit atb.Fatal()
, which is only allowed in the main test goroutine, and loggers are routinely passed to goroutines.Fatal
log in the product code, not the test, all bets are probably off anyway...