Moving old slave log files to their new locations

... based on Jesse's feedback to 1f83338dea
This commit is contained in:
Kohsuke Kawaguchi committed 2012-10-12 09:41:06 -07:00
1 parent 87d9a6e413
commit 82379c90d1
2 files changed
+72

No files matched your search

@@ -0,0 +1,31 @@
package hudson.model;
import hudson.FilePath;
import org.junit.Test;
import java.io.File;
/**
* @author Kohsuke Kawaguchi
*/
public class ComputerTest {
@Test
public void testRelocate() throws Exception {
File d = File.createTempFile("jenkins", "test");
FilePath dir = new FilePath(d);
try {
dir.delete();
dir.mkdirs();
dir.child("slave-abc.log").touch(0);
dir.child("slave-def.log.5").touch(0);
Computer.relocateOldLogs(d);
assert dir.list().size()==1; // asserting later that this one child is the logs/ directory
assert dir.child("logs/slaves/abc/slave.log").exists();
assert dir.child("logs/slaves/def/slave.log.5").exists();
} finally {
dir.deleteRecursive();
}
}
}