Tests: restart action manager before clearing store between tests

Original commit: elastic/x-pack-elasticsearch@15f057c820
This commit is contained in:
Martijn van Groningen 2014-11-25 00:17:43 +01:00
parent 4eca3c86a0
commit 00bfd694af
3 changed files with 3 additions and 2 deletions

View File

@ -216,9 +216,9 @@ public class AlertManager extends AbstractComponent {
* For testing only to clear the alerts and actions between tests.
*/
public void clear() {
actionManager.restart();
scheduler.clear();
alertsStore.clear();
actionManager.restart();
}
private void internalStop() {

View File

@ -119,7 +119,7 @@ public class AlertsStore extends AbstractComponent {
private boolean verifySameInstance(Alert alert) {
Alert found = alertMap.get(alert.alertName());
assert found == alert : "expected " + alert + " but got" + found;
assert found == alert : "expected " + alert + " but got " + found;
return true;
}

View File

@ -90,6 +90,7 @@ public class NoMasterNodeTests extends AbstractAlertingTests {
public void testMultipleFailures() throws Exception {
int numberOfFailures = scaledRandomIntBetween(2, 9);
int numberOfAlerts = scaledRandomIntBetween(numberOfFailures, 12);
logger.info("Number of failures [{}], number of alerts [{}]", numberOfFailures, numberOfAlerts);
config = new ClusterDiscoveryConfiguration.UnicastZen(2 + numberOfFailures);
internalTestCluster().startNodesAsync(2).get();
createIndex("my-index");