diff --git a/src/test/java/org/elasticsearch/test/InternalTestCluster.java b/src/test/java/org/elasticsearch/test/InternalTestCluster.java index 35311b8131d..93ac23851b5 100644 --- a/src/test/java/org/elasticsearch/test/InternalTestCluster.java +++ b/src/test/java/org/elasticsearch/test/InternalTestCluster.java @@ -784,11 +784,16 @@ public final class InternalTestCluster extends TestCluster { transportClient = null; } + void closeNode() { + registerDataPath(); + node.close(); + } + void restart(RestartCallback callback) throws Exception { assert callback != null; resetClient(); if (!node.isClosed()) { - node.close(); + closeNode(); } Settings newSettings = callback.onNodeStopped(name); if (newSettings == null) { @@ -797,18 +802,25 @@ public final class InternalTestCluster extends TestCluster { if (callback.clearData(name)) { NodeEnvironment nodeEnv = getInstanceFromNode(NodeEnvironment.class, node); if (nodeEnv.hasNodeFile()) { - IOUtils.rm(FileSystemUtils.toPaths(nodeEnv.nodeDataLocations())); + IOUtils.rm(nodeEnv.nodeDataPaths()); } } node = (InternalNode) nodeBuilder().settings(node.settings()).settings(newSettings).node(); } + void registerDataPath() { + NodeEnvironment nodeEnv = getInstanceFromNode(NodeEnvironment.class, node); + if (nodeEnv.hasNodeFile()) { + dataDirToClean.addAll(Arrays.asList(nodeEnv.nodeDataPaths())); + } + } + @Override public void close() throws IOException { resetClient(); closed.set(true); - node.close(); + closeNode(); } } @@ -1205,7 +1217,7 @@ public final class InternalTestCluster extends TestCluster { if (activeDisruptionScheme != null) { activeDisruptionScheme.removeFromNode(nodeAndClient.name, this); } - nodeAndClient.node.close(); + nodeAndClient.closeNode(); } for (NodeAndClient nodeAndClient : nodes.values()) { logger.info("Starting node [{}] ", nodeAndClient.name); @@ -1413,7 +1425,7 @@ public final class InternalTestCluster extends TestCluster { assert !nodeAndClient.node().isClosed(); NodeEnvironment nodeEnv = getInstanceFromNode(NodeEnvironment.class, nodeAndClient.node); if (nodeEnv.hasNodeFile()) { - dataDirToClean.addAll(Arrays.asList(FileSystemUtils.toPaths(nodeEnv.nodeDataLocations()))); + dataDirToClean.addAll(Arrays.asList(nodeEnv.nodeDataPaths())); } nodes.put(nodeAndClient.name, nodeAndClient); applyDisruptionSchemeToNode(nodeAndClient);