Skip to content

Commit a2174ff

Browse files
vogellaclaude
andcommitted
Fix race condition in ProgressContantsTest.testKeepOneProperty
The test was failing intermittently with "expected:<1> but was:<0>" because it was asserting the KEEPONE property result before the async cleanup logic had completed. The previous fix added an error job as a synchronization marker, but this wasn't sufficient as the cleanup can still be pending after the error job appears. This fix adds explicit waits for the actual condition being tested: that exactly 1 item from the DummyFamilyJob family remains in the progress view. By waiting for countBelongingProgressItems() to return 1, we ensure the KEEPONE cleanup has fully stabilized before asserting. Fixes: https://github.com/eclipse-platform/eclipse.platform.ui/runs/55056915330 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 6b6dd81 commit a2174ff

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/progress/ProgressContantsTest.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,8 @@ public void testKeepOneProperty() throws Exception {
223223
errorJob.schedule();
224224
processEventsUntil(() -> findProgressInfoItem(errorJob) != null, 3000);
225225
}
226+
// Wait for KEEPONE cleanup to stabilize at exactly 1 item
227+
processEventsUntil(() -> countBelongingProgressItems(DummyFamilyJob.class) == 1, 3000);
226228

227229
assertEquals("Only one finished job should be kept in view", 1,
228230
countBelongingProgressItems(DummyFamilyJob.class));
@@ -254,8 +256,8 @@ public void testKeepOneProperty() throws Exception {
254256
errorJob.schedule();
255257
processEventsUntil(() -> findProgressInfoItem(errorJob) != null, 3000);
256258
}
257-
// Additional event processing to ensure all KEEPONE logic has completed
258-
processEvents();
259+
// Wait for KEEPONE cleanup to stabilize at exactly 1 item
260+
processEventsUntil(() -> countBelongingProgressItems(DummyFamilyJob.class) == 1, 5000);
259261

260262
assertEquals("Only one finished job should be kept in view", 1,
261263
countBelongingProgressItems(DummyFamilyJob.class));

0 commit comments

Comments
 (0)