From 9dc17d7390be3e2ef4ced0a2d14e91a53535da81 Mon Sep 17 00:00:00 2001 From: Lars Vogel Date: Tue, 11 Nov 2025 09:50:13 +0100 Subject: [PATCH] Fix race condition in ProgressContantsTest.testKeepOneProperty MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- .../org/eclipse/ui/tests/progress/ProgressContantsTest.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/progress/ProgressContantsTest.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/progress/ProgressContantsTest.java index c29b96c9850..b18785a9681 100644 --- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/progress/ProgressContantsTest.java +++ b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/progress/ProgressContantsTest.java @@ -223,6 +223,8 @@ public void testKeepOneProperty() throws Exception { errorJob.schedule(); processEventsUntil(() -> findProgressInfoItem(errorJob) != null, 3000); } + // Wait for KEEPONE cleanup to stabilize at exactly 1 item + processEventsUntil(() -> countBelongingProgressItems(DummyFamilyJob.class) == 1, 3000); assertEquals("Only one finished job should be kept in view", 1, countBelongingProgressItems(DummyFamilyJob.class)); @@ -254,8 +256,8 @@ public void testKeepOneProperty() throws Exception { errorJob.schedule(); processEventsUntil(() -> findProgressInfoItem(errorJob) != null, 3000); } - // Additional event processing to ensure all KEEPONE logic has completed - processEvents(); + // Wait for KEEPONE cleanup to stabilize at exactly 1 item + processEventsUntil(() -> countBelongingProgressItems(DummyFamilyJob.class) == 1, 5000); assertEquals("Only one finished job should be kept in view", 1, countBelongingProgressItems(DummyFamilyJob.class));