Skip to content

Conversation

@vogella
Copy link
Contributor

@vogella vogella commented Nov 10, 2025

Summary

Fixes the random failure in HoverTest.testEnabledWhenHover() by ensuring the hover shell from the first test part is fully disposed before the second part begins.

Root Cause

The test has two parts that test hover behavior with different EnabledPropertyTester states:

  1. First part: setEnabled(true) - shows one hover
  2. Second part: setEnabled(false) - shows a different hover

The race condition occurred because:

  • After the first hover was verified, cleanFileAndEditor() was called
  • However, the hover shell from the first part might not be fully disposed yet
  • When the second hover was triggered, getHoverShell() would timeout waiting for the new hover shell (line 175 in the stack trace)

Fix

Added explicit waiting for the first hover shell to be disposed:

  1. Capture a reference to the first hover shell before cleanup
  2. Call cleanFileAndEditor() as before
  3. Use DisplayHelper.waitForCondition() to wait up to 3000ms for the shell to be disposed
  4. Only then proceed with the second part of the test

This ensures complete state reset between the two test phases.

Pattern

This fix follows the same pattern used in other recent flaky test fixes in this repository:

Both use condition-based waiting with DisplayHelper.waitForCondition() to ensure proper cleanup between test phases rather than relying on timing.

Test Plan

Due to environment issues, I was unable to run the full test suite locally. However, the fix follows established patterns from recent successful flaky test fixes in this repository.

Fixes #926

🤖 Generated with Claude Code

Co-Authored-By: Claude [email protected]

@github-actions
Copy link
Contributor

github-actions bot commented Nov 10, 2025

Test Results

 3 018 files  ±0   3 018 suites  ±0   2h 4m 39s ⏱️ - 2m 59s
 8 234 tests ±0   7 985 ✅ ±0  249 💤 ±0  0 ❌ ±0 
23 622 runs  ±0  22 828 ✅ ±0  794 💤 ±0  0 ❌ ±0 

Results for commit c8e1aba. ± Comparison against base commit 02dabfc.

♻️ This comment has been updated with latest results.

The testEnabledWhenHover test was failing randomly when trying to retrieve
the hover shell for the second part of the test.

Root cause:
- The test has two parts: first with EnabledPropertyTester.setEnabled(true),
  then with setEnabled(false)
- After the first hover is shown and checked, cleanFileAndEditor() is called
- However, the hover shell from the first part may not be fully disposed
  when the second editor is opened and the second hover is triggered
- This causes getHoverShell() to timeout waiting for the new hover shell

Fix:
- Capture a reference to the first hover shell before calling cleanFileAndEditor()
- After cleanFileAndEditor(), explicitly wait for the first shell to be disposed
  using DisplayHelper.waitForCondition() with a 3000ms timeout
- This ensures the hover state is fully reset before the second part begins

This approach follows the pattern used in other recent flaky test fixes in
this repository (e.g., ProgressContantsTest, ProgressViewTests) which use
condition-based waiting to ensure proper cleanup between test phases.

Fixes eclipse-platform#926

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
@vogella vogella force-pushed the fix-issue-926-flaky-hover-test-v2 branch from 9a569ed to c8e1aba Compare November 11, 2025 06:23
@vogella vogella marked this pull request as ready for review November 11, 2025 07:49
@vogella vogella merged commit d9dbf78 into eclipse-platform:master Nov 11, 2025
18 checks passed
@vogella vogella deleted the fix-issue-926-flaky-hover-test-v2 branch November 11, 2025 09:04
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.

Random failing of HoverTest.testEnabledWhenHover()

1 participant