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

Use assertThatLogger where appropriate #108732

Merged
merged 2 commits into from
May 17, 2024

Conversation

rjernst
Copy link
Member

@rjernst rjernst commented May 16, 2024

Some tests use MockLogAppender to assert on a single expected logging message. The utility method assertThatLogger handles creating the appender and asserting the expecation. However some other tests want to do the same but with multiple expectations. This commit adjusts assertThatLogger to allow multiple expectations, and converts a few tests that had helper methods that are now obsoleted.

Some tests use MockLogAppender to assert on a single expected logging
message. The utility method assertThatLogger handles creating the
appender and asserting the expecation. However some other tests want to
do the same but with multiple expectations. This commit adjusts
assertThatLogger to allow multiple expectations, and converts a few
tests that had helper methods that are now obsoleted.
@rjernst rjernst added >test Issues or PRs that are addressing/adding tests :Core/Infra/Logging Log management and logging utilities labels May 16, 2024
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-core-infra (Team:Core/Infra)

@elasticsearchmachine elasticsearchmachine added v8.15.0 Team:Core/Infra Meta label for core/infra team labels May 16, 2024
@rjernst rjernst requested a review from a team May 16, 2024 20:46
Copy link
Contributor

@ldematte ldematte left a comment

Choose a reason for hiding this comment

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

Looks like a good cleanup to me - I cannot be sure about correctness/equivalence, but if CI passes that should be all right

@rjernst rjernst merged commit f1093fb into elastic:main May 17, 2024
15 checks passed
@rjernst rjernst deleted the test/mock_appender_try5 branch May 17, 2024 14:27
parkertimmins pushed a commit to parkertimmins/elasticsearch that referenced this pull request May 17, 2024
Some tests use MockLogAppender to assert on a single expected logging
message. The utility method assertThatLogger handles creating the
appender and asserting the expecation. However some other tests want to
do the same but with multiple expectations. This commit adjusts
assertThatLogger to allow multiple expectations, and converts a few
tests that had helper methods that are now obsoleted.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Core/Infra/Logging Log management and logging utilities Team:Core/Infra Meta label for core/infra team >test Issues or PRs that are addressing/adding tests v8.15.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants