Skip to content

Commit 7a24db1

Browse files
vogellaclaude
andcommitted
Fix flaky PartRenderingEngineTests.ensureCleanUpAddonCleansUp race condition
The test was failing intermittently 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) - When hidePart() is called, it triggers events that schedule async cleanup tasks on the event queue - The test was calling waitForCondition() immediately after hiding parts, before the async cleanup tasks were even posted to the event queue - This created a race where the wait could timeout before cleanup started Fix: - Add contextRule.spinEventLoop() after hiding partB and partC to ensure async cleanup tasks are processed before waiting for the condition - Wrap waitForCondition() in assertTrue() to fail immediately with a clear message if cleanup doesn't complete within timeout - Remove redundant assertFalse() statements This matches the pattern used in the adjacent testBug332463 test which calls spinEventLoop() after each hidePart() call. Verified with 5 consecutive test runs - all passed (consistently completing in ~0.028-0.036s). Fixes #751 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 6d2b614 commit 7a24db1

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

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

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2466,12 +2466,11 @@ public void ensureCleanUpAddonCleansUp() {
24662466
assertTrue(" PartStack with children should be rendered", partStackForPartBPartC.isToBeRendered());
24672467
partService.hidePart(partB);
24682468
partService.hidePart(partC);
2469-
DisplayHelper.waitForCondition(Display.getDefault(), 5_000,
2470-
() -> partStackForPartBPartC.isToBeRendered() == false);
2471-
assertFalse(
2469+
contextRule.spinEventLoop();
2470+
assertTrue(
24722471
"CleanupAddon should ensure that partStack is not rendered anymore, as all childs have been removed",
2473-
partStackForPartBPartC.isToBeRendered());
2474-
assertFalse("Part stack should be removed", partStackForPartBPartC.isToBeRendered());
2472+
DisplayHelper.waitForCondition(Display.getDefault(), 5_000,
2473+
() -> partStackForPartBPartC.isToBeRendered() == false));
24752474
// PartStack with IPresentationEngine.NO_AUTO_COLLAPSE should not be removed
24762475
// even if children are removed
24772476
partService.hidePart(editor, true);

0 commit comments

Comments
 (0)