Skip to content

Conversation

@nielsbauman
Copy link
Contributor

At least one (testClosingWhenRunInProgress) test, but likely more, were leaking into other tests in HealthPeriodicLoggerTests. By triggering the health logger asynchronously in a separate thread, the actual health log would be logged in a subsequent test. testOutputModeNoLogging asserts that nothing is logged, so this leaking log would result in a test failure.

We simply need to wait for the separate thread to finish before proceeding to the next test.

Fixes #134200

At least one (`testClosingWhenRunInProgress`) test, but likely more,
were leaking into other tests in `HealthPeriodicLoggerTests`. By
triggering the health logger asynchronously in a separate thread, the
actual health log would be logged in a subsequent test.
`testOutputModeNoLogging` asserts that nothing is logged, so this
leaking log would result in a test failure.

We simply need to wait for the separate thread to finish before
proceeding to the next test.

Fixes elastic#134200
@nielsbauman nielsbauman requested a review from Copilot September 8, 2025 12:54
@nielsbauman nielsbauman added >test Issues or PRs that are addressing/adding tests :Data Management/Health labels Sep 8, 2025
@elasticsearchmachine elasticsearchmachine added Team:Data Management Meta label for data/management team v9.2.0 labels Sep 8, 2025
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-data-management (Team:Data Management)

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes test isolation issues in HealthPeriodicLoggerTests where asynchronous logging operations were leaking between tests. The problem occurred when health logging was triggered in separate threads but tests didn't wait for completion, causing logs to appear in subsequent tests like testOutputModeNoLogging which expects no logging output.

  • Adds join() calls to wait for logging threads to complete before ending tests
  • Removes unnecessary code blocks that were wrapping thread operations
  • Removes the muted test entry from muted-tests.yml since the issue is now fixed

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
server/src/test/java/org/elasticsearch/health/HealthPeriodicLoggerTests.java Adds thread synchronization to prevent test leakage and removes unnecessary code blocks
muted-tests.yml Removes the muted test entry for testOutputModeNoLogging

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@nielsbauman nielsbauman enabled auto-merge (squash) September 8, 2025 13:11
@nielsbauman nielsbauman merged commit 54d707c into elastic:main Sep 8, 2025
33 checks passed
@nielsbauman nielsbauman deleted the health-test-fix branch September 8, 2025 13:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

:Data Management/Health Team:Data Management Meta label for data/management team >test Issues or PRs that are addressing/adding tests v9.2.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[CI] HealthPeriodicLoggerTests testOutputModeNoLogging failing

3 participants