Skip to content

Commit a3fa065

Browse files
vogellaclaude
andcommitted
Fix flaky PartRenderingEngineTests.ensureCleanUpAddonCleansUp race condition
The test was failing intermittently on Windows CI with "CleanupAddon should ensure that partStack is not rendered anymore, as all childs have been removed" because it was checking the cleanup result before the async cleanup logic had a chance to execute. Root cause: - CleanupAddon performs cleanup asynchronously via Display.asyncExec() (CleanupAddon.java:352) - The test called contextRule.spinEventLoop() immediately after hiding parts (line 2469), which processes only currently queued events - This created a race condition: spinEventLoop() might process events before CleanupAddon's asyncExec() callback was even added to the event queue - The premature event processing caused timing issues that made the subsequent DisplayHelper.waitForCondition() unreliable Fix: - Remove the contextRule.spinEventLoop() call on line 2469 - Rely solely on DisplayHelper.waitForCondition(), which properly handles event processing via Display.sleep() with a 10ms retry interval - Simplify the condition from "isToBeRendered() == false" to "!isToBeRendered()" This follows the pattern from recent race condition fixes: - Commit 55574d8: "removing premature event processing" for RCPTestWorkbenchAdvisor - Commit 7c0684c: Using DisplayHelper.waitForCondition for async operations Verified with 5 consecutive test runs - all passed consistently (0.028-0.036s). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent 343fd57 commit a3fa065

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

tests/org.eclipse.e4.ui.tests/src/org/eclipse/e4/ui/tests/workbench/PartRenderingEngineTests.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2466,11 +2466,13 @@ public void ensureCleanUpAddonCleansUp() {
24662466
assertTrue(" PartStack with children should be rendered", partStackForPartBPartC.isToBeRendered());
24672467
partService.hidePart(partB);
24682468
partService.hidePart(partC);
2469-
contextRule.spinEventLoop();
2469+
// DisplayHelper.waitForCondition() handles event processing via Display.sleep()
2470+
// and retries. Calling spinEventLoop() here creates a race condition where
2471+
// events may be processed before CleanupAddon's asyncExec() is queued (line 352).
24702472
assertTrue(
24712473
"CleanupAddon should ensure that partStack is not rendered anymore, as all childs have been removed",
24722474
DisplayHelper.waitForCondition(Display.getDefault(), 5_000,
2473-
() -> partStackForPartBPartC.isToBeRendered() == false));
2475+
() -> !partStackForPartBPartC.isToBeRendered()));
24742476
// PartStack with IPresentationEngine.NO_AUTO_COLLAPSE should not be removed
24752477
// even if children are removed
24762478
partService.hidePart(editor, true);

0 commit comments

Comments
 (0)