Skip to content

Conversation

@vogella
Copy link
Contributor

@vogella vogella commented Nov 12, 2025

Summary

  • Fixes intermittent test failure in testBinaryContentTypeWithDescriberParallel (1 out of 3 runs failed)
  • Addresses race condition where content type registration completes asynchronously
  • Ensures binary files are correctly excluded from search results

Root Cause

The test dynamically registers a binary content type via registry.addContribution(), then immediately creates files and performs a search. However, content type registration is asynchronous, causing a race where:

  1. Files were created before the content type was fully available
  2. The binary signature describer wasn't applied in time
  3. Binary file was incorrectly included in search results (expected 1 result, got 2)

Changes

FileSearchTests.java:606-629

  1. Wait for content type registration (lines 606-618):

    • Poll Platform.getContentTypeManager() to verify content type availability
    • Retry up to 50 times with 10ms intervals (max 500ms timeout)
    • Throw clear assertion error if registration fails
  2. Force content type detection (lines 626-629):

    • Call getContentDescription() on both test files after creation
    • Explicitly triggers content type detection with newly registered describer
    • Ensures binary file is properly identified before search executes

Test Plan

  • Ran testBinaryContentTypeWithDescriberParallel 5 consecutive times - all passed
  • Ran entire FileSearchTests suite - all 19 tests passed
  • Verified fix doesn't impact test performance (resolves in first iteration typically)

Related

Similar race condition fixes in recent commits:

  • dd5d18e: Fix flaky DynamicTest.testDynamicRegistry
  • a2174ff: Fix race condition in ProgressContantsTest
  • d9dbf78: Fix flaky HoverTest.testEnabledWhenHover()

🤖 Generated with Claude Code

@vogella vogella marked this pull request as draft November 12, 2025 08:56
…dition

The test was failing intermittently (1 out of 3 runs) due to a race
condition in content type registration. The test dynamically registers
a binary content type but files were created and searched before the
content type was fully available, causing the binary file to be
incorrectly included in search results.

This fix adds:
1. Explicit wait loop to verify content type is registered before
   proceeding (up to 500ms with 10ms intervals)
2. Force content type detection on files after creation by calling
   getContentDescription() to ensure binary signature describer is
   properly applied

Verified with 5 consecutive test runs - all passed.

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

Co-Authored-By: Claude <[email protected]>
@vogella vogella force-pushed the fix-flaky-binary-content-type-test branch 2 times, most recently from 8acd305 to 9a067f2 Compare November 12, 2025 08:58
@vogella vogella marked this pull request as ready for review November 12, 2025 09:14
@github-actions
Copy link
Contributor

Test Results

 3 018 files  + 3 018   3 018 suites  +3 018   2h 25m 15s ⏱️ + 2h 25m 15s
 8 234 tests + 8 234   7 985 ✅ + 7 985  249 💤 +249  0 ❌ ±0 
23 622 runs  +23 622  22 828 ✅ +22 828  794 💤 +794  0 ❌ ±0 

Results for commit 9a067f2. ± Comparison against base commit 0e238b7.

@vogella vogella merged commit 6d2b614 into eclipse-platform:master Nov 12, 2025
18 checks passed
@vogella vogella deleted the fix-flaky-binary-content-type-test branch November 12, 2025 11:47
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.

1 participant