Skip to content

Conversation

@vogella
Copy link
Contributor

@vogella vogella commented Nov 4, 2025

The test was failing intermittently on Windows with "expected: <1> but was: <2>" because it was searching the entire project scope where files from other concurrent tests could interfere.

Changes:

  • Use unique timestamped folder name to avoid conflicts
  • Narrow search scope to only the test's specific folder
  • Add comments explaining the fix

This ensures test isolation when running in parallel.

Fixes #3490

🤖 Generated with Claude Code

@github-actions
Copy link
Contributor

github-actions bot commented Nov 4, 2025

Test Results

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

Results for commit 8a91157. ± Comparison against base commit c6e9f0f.

♻️ This comment has been updated with latest results.

@vogella
Copy link
Contributor Author

vogella commented Nov 4, 2025

@HeikoKlare @fedejeanne WDYT?

@vogella
Copy link
Contributor Author

vogella commented Nov 5, 2025

@HeikoKlare any concerns?

Comment on lines 605 to 606
String uniqueFolderName= "binaryContentTypeTest-" + System.currentTimeMillis();
IFolder folder= ResourceHelper.createFolder(fProject.getFolder(uniqueFolderName));
Copy link
Contributor

Choose a reason for hiding this comment

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

These tests are JUnit 5, so wouldn't it be better to use the TempDirectory extension to create unique temporary directories? Using currentTimeMillis() to avoid conflicts seems to be prone to errors as well, as no one can guarantee that two tests methods do not call this method at the same time (same time = even sequential but at same system time millis). Note that this private methods is called from two methods which could thus both produce the exact same folder name.

Copy link
Member

Choose a reason for hiding this comment

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

Just a practical thought: how big are the chances of a name collision happening? We have other tests doing the same trick and they are stable.

Copy link
Member

Choose a reason for hiding this comment

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

If it has to be under the fProject folder, then maybe just use java.util.UUID.randomUUID().toString()?

Copy link
Contributor

Choose a reason for hiding this comment

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

I had many tests failing for such a reason when stabilizing the Platform tests two years ago. Tests might be stable with such a hack, some are like that forever, some are until you move to a different infrastructure (which was the reason for the Platform tests starting to get flaky because they were suddently executed on random machines via GHA instead of dedicated servers running Jenkins).
And in any case, when investing the time into fixing a test anyway, I would be in favor of doing it properly rather than doing something that is prone to fail later on again. But still, better have a fixed test for now than not having any improvement at all, so please take it as a hint/proposal and not as a request from my side.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks @HeikoKlare @fedejeanne and @sratz Proposal looks great to me, I will ask Claude AI to update the PR with the proposal.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Isn't it nice that Claude code takes the same amount of time to think about @sratz proposal, agree to it and adjusting the PR, them me writing the above statement?

The test was failing intermittently on Windows with "expected: <1> but
was: <2>" because it was searching the entire project scope where files
from other concurrent tests could interfere.

Changes:
- Use unique timestamped folder name to avoid conflicts
- Narrow search scope to only the test's specific folder
- Add comments explaining the fix

This ensures test isolation when running in parallel.

Fixes eclipse-platform#3490

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

Co-Authored-By: Claude <[email protected]>
@vogella vogella force-pushed the fix-flaky-file-search-test branch from 5172a94 to 8a91157 Compare November 6, 2025 13:58
@vogella vogella merged commit c8fa9e7 into eclipse-platform:master Nov 6, 2025
18 checks passed
@vogella vogella deleted the fix-flaky-file-search-test branch November 6, 2025 17:41
@vogella
Copy link
Contributor Author

vogella commented Nov 6, 2025

Thanks everybody for the review and help.

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.

Flacky Test: org.eclipse.search.tests.filesearch.FileSearchTests fails on windows

4 participants