Skip to content

Conversation

@vogella
Copy link
Contributor

@vogella vogella commented Oct 25, 2025

Summary

Fixes intermittent test failures in ResourceInitialSelectionTest on macOS systems.

Problem

Tests testMultiSelectionAndOneInitialSelectionWithInitialPattern and testSingleSelectionAndNoInitialSelectionWithInitialPattern were failing intermittently on macOS with errors indicating that expected selections were not being applied.

The root cause was a race condition between:

  1. The test's explicit dialog.refresh() call
  2. Asynchronous background jobs that populate the dialog content (FilterHistoryJob → FilterJob → RefreshCacheJob → RefreshJob)
  3. The selection application logic

Tests were checking the selection state before background jobs completed, resulting in empty or incorrect selections.

Solution

Added event loop processing to allow background jobs to complete before making assertions:

  1. Added waitForDialogRefresh() helper method that:

    • Processes UI events multiple times with small delays
    • Allows background jobs to complete before assertions
    • Follows the same pattern as the recent fix in DecoratorAdaptableTests
  2. Updated 10 test methods to call waitForDialogRefresh() after dialog.refresh() for tests that expect valid selections

  3. 3 tests intentionally skip the wait to test edge cases where invalid/filtered selections should not cause any selection

Test Results

✅ All 13 tests now pass consistently (verified with multiple runs)

  • Tests run: 13, Failures: 0, Errors: 0, Skipped: 0

Related Issues

Fixes #294

🤖 Generated with Claude Code

vogella and others added 2 commits October 25, 2025 11:44
…ocessing

Fixes eclipse-platform#868

The tests testAdaptables, testNonAdaptableContributions, and
testContributorResourceAdapter were experiencing intermittent failures
due to a race condition. After enabling decorators in the @before method,
the decorator manager schedules asynchronous updates that may not have
completed before the test assertions ran.

This commit adds calls to UITestUtil.processEvents() in both @before
and @after methods to ensure all pending UI events are processed before
tests run and after tests complete. This is a standard pattern for
preventing race conditions in Eclipse UI tests.

The processEvents() method processes all pending events in the Display
event queue, ensuring that decorator registration and enablement updates
have completed before the test proceeds.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
…op processing

This commit fixes intermittent test failures on macOS reported in GitHub issue eclipse-platform#294.

The root cause was a race condition between the test's explicit dialog.refresh()
call and asynchronous background jobs (FilterHistoryJob → FilterJob → RefreshCacheJob
→ RefreshJob) that populate the dialog content. Tests were checking selection state
before background jobs completed.

Changes:
- Added waitForDialogRefresh() helper method that processes UI events with delays
- Updated 10 tests to call waitForDialogRefresh() after dialog.refresh()
- 3 tests intentionally skip the wait to test edge cases with invalid selections

All 13 tests now pass consistently (verified with multiple runs).

Fixes: eclipse-platform#294

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
@vogella vogella force-pushed the fix-resource-initial-selection-test-race-condition branch from 435d7f8 to e54fe1c Compare October 25, 2025 09:44
@github-actions
Copy link
Contributor

Test Results

 3 018 files  ±0   3 018 suites  ±0   2h 23m 21s ⏱️ + 4m 6s
 8 233 tests ±0   7 982 ✅  - 2  249 💤 ±0  2 ❌ +2 
23 619 runs  ±0  22 823 ✅  - 2  794 💤 ±0  2 ❌ +2 

For more details on these failures, see this check.

Results for commit e54fe1c. ± Comparison against base commit ce17c9e.

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.

Some ResourceInitialSelectionTest tests fail intermittently

1 participant