[TEST] Don't delete data dirs after test - only delete their content.
Closes #5815
This commit is contained in:
parent
9898eed30c
commit
c5c87c4a48
|
@ -74,20 +74,23 @@ public class FileSystemUtils {
|
|||
return false;
|
||||
}
|
||||
|
||||
public static boolean deleteRecursively(File[] roots) {
|
||||
/**
|
||||
* Deletes the given files recursively. if <tt>deleteRoots</tt> is set to <code>true</code>
|
||||
* the given root files will be deleted as well. Otherwise only their content is deleted.
|
||||
*/
|
||||
public static boolean deleteRecursively(File[] roots, boolean deleteRoots) {
|
||||
boolean deleted = true;
|
||||
for (File root : roots) {
|
||||
deleted &= deleteRecursively(root);
|
||||
deleted &= deleteRecursively(root, deleteRoots);
|
||||
}
|
||||
return deleted;
|
||||
}
|
||||
|
||||
public static boolean deleteRecursively(File root) {
|
||||
return deleteRecursively(root, true);
|
||||
}
|
||||
|
||||
private static boolean innerDeleteRecursively(File root) {
|
||||
return deleteRecursively(root, true);
|
||||
/**
|
||||
* Deletes the given files recursively including the given roots.
|
||||
*/
|
||||
public static boolean deleteRecursively(File... roots) {
|
||||
return deleteRecursively(roots, true);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -105,7 +108,7 @@ public class FileSystemUtils {
|
|||
File[] children = root.listFiles();
|
||||
if (children != null) {
|
||||
for (File aChildren : children) {
|
||||
innerDeleteRecursively(aChildren);
|
||||
deleteRecursively(aChildren, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -762,10 +762,11 @@ public final class TestCluster extends ImmutableTestCluster {
|
|||
|
||||
private void wipeDataDirectories() {
|
||||
if (!dataDirToClean.isEmpty()) {
|
||||
logger.info("Wipe data directory for all nodes locations: {}", this.dataDirToClean);
|
||||
boolean deleted = false;
|
||||
try {
|
||||
FileSystemUtils.deleteRecursively(dataDirToClean.toArray(new File[dataDirToClean.size()]));
|
||||
deleted = FileSystemUtils.deleteRecursively(dataDirToClean.toArray(new File[dataDirToClean.size()]), false);
|
||||
} finally {
|
||||
logger.info("Wipe data directory for all nodes locations: {} success: {}", this.dataDirToClean, deleted);
|
||||
this.dataDirToClean.clear();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue