Test: fixed test timing issue

Original commit: elastic/x-pack-elasticsearch@ccdac702f4
This commit is contained in:
Martijn van Groningen 2015-03-02 14:17:37 +01:00
parent 803fa4c4df
commit 96d80597c4
1 changed files with 7 additions and 0 deletions

View File

@ -108,6 +108,13 @@ public class BasicAlertsTests extends AbstractAlertsIntegrationTests {
.get();
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");
DeleteAlertResponse deleteAlertResponse = alertsClient.deleteAlert(deleteAlertRequest).actionGet();
assertNotNull(deleteAlertResponse.deleteResponse());