NO-JIRA Adding test name into temporary folder name directory

This is to make it possible to identify what test is leaking files whenever that is happening.
That is because future tests will report the leaks, and it's difficult to identify where it happened.

Also i'm changing NoProcessFilesBehind to show the getOpenFD propertly
This commit is contained in:
Clebert Suconic 2020-01-10 17:35:28 -05:00
parent 3fff744de4
commit bbe9f9adce
2 changed files with 4 additions and 2 deletions

View File

@ -264,7 +264,9 @@ public abstract class ActiveMQTestBase extends Assert {
public ActiveMQTestBase() { public ActiveMQTestBase() {
File parent = new File(TARGET_TMP); File parent = new File(TARGET_TMP);
parent.mkdirs(); parent.mkdirs();
temporaryFolder = new TemporaryFolder(parent); File subParent = new File(parent, this.getClass().getSimpleName());
subParent.mkdirs();
temporaryFolder = new TemporaryFolder(subParent);
} }
protected <T> T serialClone(Object object) throws Exception { protected <T> T serialClone(Object object) throws Exception {

View File

@ -139,7 +139,7 @@ public class NoProcessFilesBehind extends TestWatcher {
if (!Wait.waitFor(() -> getOpenFD() < maxFiles, 5000, 0)) { if (!Wait.waitFor(() -> getOpenFD() < maxFiles, 5000, 0)) {
String fileList = getOpenList(); String fileList = getOpenList();
Assert.fail("Too many files open (" + maxFiles + "). A possible list: " + fileList); Assert.fail("Too many files open (" + getOpenFD() + ">" + maxFiles + "). A possible list: " + fileList);
} }
} }