fix: stop tests from deleting the system temp dir and FileUtils.delete from following symlinks - #1170
Open
AhmedYoussef98 wants to merge 1 commit into
Open
AhmedYoussef98 wants to merge 1 commit into
AhmedYoussef98 wants to merge 1 commit into
Conversation
…e from following symlinks
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Purpose of the pull request
Closed: #1169
What's changed?
CompatibilityTest#readWithCacheAfterTempDeletionnow deletes only Fesod's own temp directory (FileUtils.getTempFilePrefix()) and no longer deletes the wholejava.io.tmpdir. That is still what the test means to check: Fesod recovers when its temp and cache files are removed while idle. The system temp directory is shared with other processes, so a test must never delete it.FileUtils.deletenow deletes a symbolic link itself and does not follow it. Before,File.isDirectory()/listFiles()resolved links, so the recursive delete could leave the directory it was given. On macOS, anApplications -> /Applicationslink inside a mounted installer DMG under$TMPDIRled it to wipe application bundles (details in [Bug] CompatibilityTest deletes the whole system temp dir, and FileUtils.delete follows symlinks out of it #1169).FileUtilsTest#test_delete_doesNotFollowSymbolicLinks. It fails on currentmain(the link target's contents are deleted) and passes with this change. It is skipped where symbolic links can't be created.Verified with
./mvnw package -Dmaven.test.skip=false -Dtest='FileUtilsTest,CompatibilityTest' -pl fesod-common,fesod-shaded,fesod-sheet(27 tests, all passing) and./mvnw spotless:check.Checklist