mirror of
https://github.com/apple/swift-nio
synced 2026-11-24 04:37:54 +00:00
### Motivation `testCopyFileReplacingExistingFileSucceeds` (and `testCopySymlinkReplacingExistingSymlinkSucceeds`) verify that no .tmp- prefixed files are left behind after a `copyItem(replaceExisting: true)` call on Linux. However, both tests create their files in the shared system temp directory (e.g. /tmp) and then scan that entire directory for .tmp- files. When other tests run in parallel, their in-flight `copyItem(replaceExisting: true)` operations leave transient .tmp- files in the same directory, causing spurious failures. ### Changes - Both tests now create a dedicated subdirectory for their files, so the temp file scan only sees files belonging to that specific test. - Cleanup is handled via `addTeardownBlock` to ensure the subdirectory is removed even if the test fails early. ### Results The temp file assertions are no longer affected by concurrent test activity or other processes writing to the shared temp directory, eliminating the flakiness.