Skip to content

Fix flaky AsyncContentAssistTest.testCompleteActivationChar#3779

Open
vogella wants to merge 2 commits intoeclipse-platform:masterfrom
vogella:unit-test-error
Open

Fix flaky AsyncContentAssistTest.testCompleteActivationChar#3779
vogella wants to merge 2 commits intoeclipse-platform:masterfrom
vogella:unit-test-error

Conversation

@vogella
Copy link
Contributor

@vogella vogella commented Mar 16, 2026

Summary

  • Replace Display.post() with control.notifyListeners() for reliable event delivery in headless CI environments — Display.post() sends native OS events that may not be processed, causing the content assist popup to never appear
  • Fix race condition by capturing beforeShells before posting key events, and process events after shell.open()
  • Increase findNewShell timeout from 1s to 5s for slower CI environments
  • Remove Windows-only assumeFalse skip — the test now works on all platforms

Test plan

  • Ran AsyncContentAssistTest 5 times consecutively — all passes
  • Ran full org.eclipse.jface.text.tests suite — no regressions (only pre-existing CodeMiningTest failures)

Fixes #890

vogella and others added 2 commits March 16, 2026 11:45
Replace Display.post() with control.notifyListeners() for reliable
event delivery in headless CI environments. Display.post() sends
native OS events that may not be processed, causing the content
assist popup to never appear.

Also fix race condition by capturing beforeShells before posting
key events, process events after shell.open(), and increase
findNewShell timeout from 1s to 5s for slower CI environments.

Fixes eclipse-platform#890
@eclipse-platform-bot
Copy link
Contributor

This pull request changes some projects for the first time in this development cycle.
Therefore the following files need a version increment:

tests/org.eclipse.jface.text.tests/META-INF/MANIFEST.MF

An additional commit containing all the necessary changes was pushed to the top of this PR's branch. To obtain these changes (for example if you want to push more changes) either fetch from your fork or apply the git patch.

Git patch
From 2fa5709198f25b83d550a4529241f52eedeb9325 Mon Sep 17 00:00:00 2001
From: Eclipse Platform Bot <platform-bot@eclipse.org>
Date: Mon, 16 Mar 2026 10:51:19 +0000
Subject: [PATCH] Version bump(s) for 4.40 stream


diff --git a/tests/org.eclipse.jface.text.tests/META-INF/MANIFEST.MF b/tests/org.eclipse.jface.text.tests/META-INF/MANIFEST.MF
index 7cc57c18bf..0c0524f3eb 100644
--- a/tests/org.eclipse.jface.text.tests/META-INF/MANIFEST.MF
+++ b/tests/org.eclipse.jface.text.tests/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
 Bundle-ManifestVersion: 2
 Bundle-Name: %Plugin.name
 Bundle-SymbolicName: org.eclipse.jface.text.tests
-Bundle-Version: 3.14.0.qualifier
+Bundle-Version: 3.14.100.qualifier
 Bundle-Vendor: %Plugin.providerName
 Bundle-Localization: plugin
 Export-Package: 
-- 
2.53.0

Further information are available in Common Build Issues - Missing version increments.

@github-actions
Copy link
Contributor

Test Results

   852 files  ±0     852 suites  ±0   51m 45s ⏱️ - 10m 8s
 7 848 tests ±0   7 605 ✅ ±0  243 💤 ±0  0 ❌ ±0 
20 070 runs  ±0  19 415 ✅ +1  655 💤  - 1  0 ❌ ±0 

Results for commit c4003c2. ± Comparison against base commit 5b68739.

@vogella
Copy link
Contributor Author

vogella commented Mar 16, 2026

@trancexpress please review

@trancexpress
Copy link
Contributor

@trancexpress please review

@laeubi can you review the change? I'm not sure what the intent is of sending SWT events. Sending the event directly to a widget seems odd to me, but so does sending SWT events.

final Collection<Shell> beforeShells= AbstractContentAssistTest.getCurrentShells();
// Use notifyListeners instead of Display.post() for reliable event delivery
// Display.post() sends native OS events that may not be processed reliably
// in headless CI environments
Copy link
Contributor

@trancexpress trancexpress Mar 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any idea why that would be? For better or worse we have a lot of tests that sent SWT events and we don't see sporadic fails with them.

Is something buggy in the the test or in the Eclipse CI environment, when it comes to UI event handling?

keyEvent.type= SWT.KeyUp;
control.getDisplay().post(keyEvent);
final Collection<Shell> beforeShells= AbstractContentAssistTest.getCurrentShells();
control.notifyListeners(SWT.KeyDown, keyEvent);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would start with adding a listener to the widget and recording if the sent event is received. Then a check can validate that the event was received, prior to the timeout assert fail.

That way we would be certain that the problem really is event handling and not something else. If we do know event processing is buggy, a change like this still seems odd but it would be fine from my POV - if the test still tests what it should (Christoph can comment on this, I cannot).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

JUnit tests in org.eclipse.jface.text.tests.contentassist are failing on Windows and Mac

3 participants