From 23bdad05658966dfbd72603759f4d91143d1d913 Mon Sep 17 00:00:00 2001 From: Lars Vogel Date: Wed, 17 Jun 2026 20:29:15 +0200 Subject: [PATCH] Stabilize QuickAccessDialogTest by warming lazy providers in setUp The UI-requiring quick access providers (commands, preferences, actions, contributed computers, ...) are constructed and queried lazily on the first non-empty filter. That first query runs each provider on the UI thread and can block it for many seconds on a cold workbench. The setUp warmup only opened the dialog with an empty filter, which skips those providers, so the one-time initialization landed inside whichever test typed the first filter and could exceed its timed wait. On a slow macOS runner this froze the UI thread for about 28s and timed out testPreviousChoicesAvailableForExtension with an empty table. Type a real filter on the warmup dialog and wait for results so the cold initialization happens during setUp, outside any timed assertion. Every subsequent query then hits the warm, fast path. Addresses https://github.com/eclipse-platform/eclipse.platform.ui/issues/4009 --- .../ui/tests/quickaccess/QuickAccessDialogTest.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/quickaccess/QuickAccessDialogTest.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/quickaccess/QuickAccessDialogTest.java index ac05249c3a1..cab5357d026 100644 --- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/quickaccess/QuickAccessDialogTest.java +++ b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/quickaccess/QuickAccessDialogTest.java @@ -85,6 +85,10 @@ protected void setInfoText(String text) { } private static final int TIMEOUT = 5000; + // Generous bound for the one-time cold initialization of the lazy providers. + private static final int WARMUP_TIMEOUT = 60000; + // The lazy providers initialize once per JVM, so warm them only once. + private static boolean providersWarmedUp; // As defined in QuickAccessDialog and in SearchField private static final int MAXIMUM_NUMBER_OF_ELEMENTS = 60; private static final Predicate isQuickAccessShell = shell -> shell.getText() @@ -109,6 +113,15 @@ public void setUp() throws Exception { activeWorkbenchWindow = openTestWindow(); QuickAccessDialog warmupDialog = new QuickAccessDialog(activeWorkbenchWindow, null); warmupDialog.open(); + if (!providersWarmedUp) { + // Warm the lazy providers once with a real filter so their slow first query + // runs here, not inside a test's timed wait. An empty filter skips them. + Text warmupText = warmupDialog.getQuickAccessContents().getFilterText(); + Table warmupTable = warmupDialog.getQuickAccessContents().getTable(); + warmupText.setText("t"); + DisplayHelper.waitForCondition(warmupText.getDisplay(), WARMUP_TIMEOUT, () -> warmupTable.getItemCount() > 0); + providersWarmedUp = true; + } warmupDialog.close(); }