[Tests] improved automatic disruption healing after tests
This commit is contained in:
parent
5e5f8a9daf
commit
e897dccb52
|
@ -835,19 +835,6 @@ public final class InternalTestCluster extends TestCluster {
|
||||||
}
|
}
|
||||||
|
|
||||||
private synchronized void reset(boolean wipeData) throws IOException {
|
private synchronized void reset(boolean wipeData) throws IOException {
|
||||||
TimeValue expectedHealingTime = activeDisruptionScheme != null ? activeDisruptionScheme.expectedTimeToHeal() : null;
|
|
||||||
clearDisruptionScheme();
|
|
||||||
if (expectedHealingTime != null && expectedHealingTime.millis() > 0) {
|
|
||||||
try {
|
|
||||||
Thread.sleep(expectedHealingTime.millis());
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
Thread.currentThread().interrupt();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
randomlyResetClients();
|
|
||||||
if (wipeData) {
|
|
||||||
wipeDataDirectories();
|
|
||||||
}
|
|
||||||
// clear all rules for mock transport services
|
// clear all rules for mock transport services
|
||||||
for (NodeAndClient nodeAndClient : nodes.values()) {
|
for (NodeAndClient nodeAndClient : nodes.values()) {
|
||||||
TransportService transportService = nodeAndClient.node.injector().getInstance(TransportService.class);
|
TransportService transportService = nodeAndClient.node.injector().getInstance(TransportService.class);
|
||||||
|
@ -855,6 +842,22 @@ public final class InternalTestCluster extends TestCluster {
|
||||||
((MockTransportService) transportService).clearAllRules();
|
((MockTransportService) transportService).clearAllRules();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (activeDisruptionScheme != null) {
|
||||||
|
TimeValue expectedHealingTime = activeDisruptionScheme.expectedTimeToHeal();
|
||||||
|
clearDisruptionScheme();
|
||||||
|
if (expectedHealingTime != null && expectedHealingTime.millis() > 0) {
|
||||||
|
try {
|
||||||
|
Thread.sleep(expectedHealingTime.millis());
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
Thread.currentThread().interrupt();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
assert !client().admin().cluster().prepareHealth().setWaitForNodes("" + nodes.size()).get().isTimedOut() : "cluster failed to form after disruption was healed";
|
||||||
|
}
|
||||||
|
randomlyResetClients();
|
||||||
|
if (wipeData) {
|
||||||
|
wipeDataDirectories();
|
||||||
|
}
|
||||||
if (nextNodeId.get() == sharedNodesSeeds.length && nodes.size() == sharedNodesSeeds.length) {
|
if (nextNodeId.get() == sharedNodesSeeds.length && nodes.size() == sharedNodesSeeds.length) {
|
||||||
logger.debug("Cluster hasn't changed - moving out - nodes: [{}] nextNodeId: [{}] numSharedNodes: [{}]", nodes.keySet(), nextNodeId.get(), sharedNodesSeeds.length);
|
logger.debug("Cluster hasn't changed - moving out - nodes: [{}] nextNodeId: [{}] numSharedNodes: [{}]", nodes.keySet(), nextNodeId.get(), sharedNodesSeeds.length);
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in New Issue