Test: fixed test timing issue
Original commit: elastic/x-pack-elasticsearch@ccdac702f4
This commit is contained in:
parent
803fa4c4df
commit
96d80597c4
|
@ -108,6 +108,13 @@ public class BasicAlertsTests extends AbstractAlertsIntegrationTests {
|
||||||
.get();
|
.get();
|
||||||
assertThat(indexResponse.indexResponse().isCreated(), is(true));
|
assertThat(indexResponse.indexResponse().isCreated(), is(true));
|
||||||
|
|
||||||
|
// TODO: when MockScheduler can be used this workaround can be removed:
|
||||||
|
// Although there is no added benefit in this test for waiting for the alert to fire, however
|
||||||
|
// we need to wait here because of a test timing issue. When we tear down a test we delete the alert and delete all
|
||||||
|
// indices, but there may still be inflight fired alerts, which may trigger the alert history to be created again, before
|
||||||
|
// we finished the tear down phase.
|
||||||
|
assertAlertWithNoActionNeeded("my-first-alert", 1);
|
||||||
|
|
||||||
DeleteAlertRequest deleteAlertRequest = new DeleteAlertRequest("my-first-alert");
|
DeleteAlertRequest deleteAlertRequest = new DeleteAlertRequest("my-first-alert");
|
||||||
DeleteAlertResponse deleteAlertResponse = alertsClient.deleteAlert(deleteAlertRequest).actionGet();
|
DeleteAlertResponse deleteAlertResponse = alertsClient.deleteAlert(deleteAlertRequest).actionGet();
|
||||||
assertNotNull(deleteAlertResponse.deleteResponse());
|
assertNotNull(deleteAlertResponse.deleteResponse());
|
||||||
|
|
Loading…
Reference in New Issue