mirror of
https://github.com/jenkinsci/jenkins.git
synced 2026-11-14 20:42:21 +00:00
JENKINS-41805 Cleanup workspace suffixes (#4824)
This commit is contained in:
1 parent
55d1b9e387
commit
e9dc2694db
4 files changed
+58
-6
No files matched your search
@@ -28,6 +28,7 @@ import hudson.model.TaskListener;
|
||||
import hudson.os.PosixAPI;
|
||||
import hudson.os.WindowsUtil;
|
||||
import hudson.remoting.VirtualChannel;
|
||||
import hudson.slaves.WorkspaceList;
|
||||
import hudson.util.NullStream;
|
||||
import hudson.util.StreamTaskListener;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
@@ -810,6 +811,20 @@ public class FilePathTest {
|
||||
assertFalse("could not delete target", Files.exists(toDelete));
|
||||
}
|
||||
|
||||
@Test
|
||||
@Issue("JENKINS-44909")
|
||||
public void deleteSuffixesRecursive() throws Exception {
|
||||
File deleteSuffixesRecursiveFolder = temp.newFolder("deleteSuffixesRecursive");
|
||||
FilePath filePath = new FilePath(deleteSuffixesRecursiveFolder);
|
||||
FilePath suffix = filePath.withSuffix(WorkspaceList.COMBINATOR + "suffixed");
|
||||
FilePath textTempFile = suffix.createTextTempFile("tmp", null, "dummy", true);
|
||||
|
||||
assertThat(textTempFile.exists(), is(true));
|
||||
|
||||
filePath.deleteSuffixesRecursive();
|
||||
assertThat(textTempFile.exists(), is(false));
|
||||
}
|
||||
|
||||
@Test public void deleteRecursiveOnWindows() throws Exception {
|
||||
assumeTrue("Uses Windows-specific features", Functions.isWindows());
|
||||
Path targetDir = temp.newFolder("targetDir").toPath();
|
||||
|
||||
Reference in new issue
Block a user