The GitHub Actions job "Java CI" on commons-vfs.git/feature/junit5-migration 
has succeeded.
Run started by GitHub user gnodet (triggered by gnodet).

Head commit for run:
741eec79f5f53ddf829bdfe5d05ccab24a2c50ad / Guillaume Nodet <[email protected]>
Fix RamProviderTest race condition by using isolated test directory

Fixed non-deterministic test failure in RamProviderTest on macOS CI
where the test would intermittently fail with:
  FileSystemException: Could not read from "...permission.txt" because it is 
not a file.

Root Cause:
This is a race condition between RamProviderTest and LocalProviderTest:
1. RamProviderTest imports target/test-classes/test-data/ into RAM
2. LocalProviderTest uses the SAME directory and runs PermissionsTests
   which creates permission.txt with restricted permissions
3. If RamProviderTest's importTree() runs while LocalProviderTest is
   creating/modifying permission.txt, it fails to read the file

The issue is non-deterministic because it depends on test execution
timing and only manifests on certain OS/JDK combinations.

Solution:
Instead of making importTree() more tolerant of errors, we eliminate
the race condition entirely by giving RamProviderTest its own isolated
copy of the test data directory.

Changes:
- RamProviderTest now creates a temporary copy of test-data in
  /tmp/vfs-ram-test-XXXXX/ before importing into RAM
- The temp directory is cleaned up in tearDown()
- This ensures complete test isolation with no shared state

Benefits:
- Eliminates race condition completely
- Tests run faster (0.385s vs 4.4s) due to no I/O contention
- Cleaner solution than catching exceptions
- No changes needed to production code (RamFileSystem)

Test Results:
- RamProviderTest: 97 tests, 0 failures, 0 errors
- RamProviderTest + LocalProviderTest: 200 tests, 0 failures, 0 errors
- Temp directories are properly cleaned up after tests

Report URL: https://github.com/apache/commons-vfs/actions/runs/18340802889

With regards,
GitHub Actions via GitBox

Reply via email to