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.
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.
It's not obvious to me why it would panic. It's not explained in the description of this PR either.
I think it would be preferable if we made the test logger in
elastic-agent-libsto never panic somehow:https://github.com/elastic/elastic-agent-libs/blob/03ca4525a4b679f00ea3baeeafe2a76e469e486c/logp/logptest/logptest.go#L33-L42
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.
logptest.NewTestingLoggeruses thetesting.Tas the logger output, if the test ends and the logger tries to log, then thetesting.Tpanics.It is, the explanation is in the proposed commit message:
Log in goroutine after Testxxx has completed
The root cause of the panics are components that do not get completely shutdown and try to log something after the test ends, leading to a panic. Which actually exposes an issue with the test design or the component design.
For the test logger never to panic we "just" need to stop using
zaptest.NewLogger, which I believe is the main feature oflogptest.NewTestingLogger.You have a good point there, I'll make a PR for it.
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.
@rdner I created this PR to make
logptest.NewTestingLoggernot panic any more.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.
@belimawr after merging elastic/elastic-agent-libs#368 do you still think it makes sense to make this change?
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.
No, if we merge elastic/elastic-agent-libs#368, we won't need this PR any more.