Tests: restart action manager before clearing store between tests
Original commit: elastic/x-pack-elasticsearch@15f057c820
This commit is contained in:
parent
4eca3c86a0
commit
00bfd694af
|
@ -216,9 +216,9 @@ public class AlertManager extends AbstractComponent {
|
||||||
* For testing only to clear the alerts and actions between tests.
|
* For testing only to clear the alerts and actions between tests.
|
||||||
*/
|
*/
|
||||||
public void clear() {
|
public void clear() {
|
||||||
|
actionManager.restart();
|
||||||
scheduler.clear();
|
scheduler.clear();
|
||||||
alertsStore.clear();
|
alertsStore.clear();
|
||||||
actionManager.restart();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void internalStop() {
|
private void internalStop() {
|
||||||
|
|
|
@ -119,7 +119,7 @@ public class AlertsStore extends AbstractComponent {
|
||||||
|
|
||||||
private boolean verifySameInstance(Alert alert) {
|
private boolean verifySameInstance(Alert alert) {
|
||||||
Alert found = alertMap.get(alert.alertName());
|
Alert found = alertMap.get(alert.alertName());
|
||||||
assert found == alert : "expected " + alert + " but got" + found;
|
assert found == alert : "expected " + alert + " but got " + found;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -90,6 +90,7 @@ public class NoMasterNodeTests extends AbstractAlertingTests {
|
||||||
public void testMultipleFailures() throws Exception {
|
public void testMultipleFailures() throws Exception {
|
||||||
int numberOfFailures = scaledRandomIntBetween(2, 9);
|
int numberOfFailures = scaledRandomIntBetween(2, 9);
|
||||||
int numberOfAlerts = scaledRandomIntBetween(numberOfFailures, 12);
|
int numberOfAlerts = scaledRandomIntBetween(numberOfFailures, 12);
|
||||||
|
logger.info("Number of failures [{}], number of alerts [{}]", numberOfFailures, numberOfAlerts);
|
||||||
config = new ClusterDiscoveryConfiguration.UnicastZen(2 + numberOfFailures);
|
config = new ClusterDiscoveryConfiguration.UnicastZen(2 + numberOfFailures);
|
||||||
internalTestCluster().startNodesAsync(2).get();
|
internalTestCluster().startNodesAsync(2).get();
|
||||||
createIndex("my-index");
|
createIndex("my-index");
|
||||||
|
|
Loading…
Reference in New Issue