TEST: Add extra logging when alert didn't trigger an action.

Original commit: elastic/x-pack-elasticsearch@bc389fccdc
This commit is contained in:
Brian Murphy 2014-11-20 22:22:50 +00:00
parent 32e7bc45b1
commit 42d484b62a
1 changed files with 11 additions and 1 deletions

View File

@ -25,6 +25,7 @@ import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentFactory;
import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.script.ScriptService;
import org.elasticsearch.search.SearchHit;
import org.elasticsearch.test.ElasticsearchIntegrationTest;
import org.junit.Test;
@ -37,7 +38,7 @@ import static org.hamcrest.core.IsEqual.equalTo;
/**
*/
@ElasticsearchIntegrationTest.ClusterScope(scope = ElasticsearchIntegrationTest.Scope.TEST, numClientNodes = 0, transportClientRatio = 0, numDataNodes = 1)
@ElasticsearchIntegrationTest.ClusterScope(scope = ElasticsearchIntegrationTest.Scope.SUITE, numClientNodes = 0, transportClientRatio = 0)
public class AlertThrottleTests extends AbstractAlertingTests {
@Test
@ -161,6 +162,15 @@ public class AlertThrottleTests extends AbstractAlertingTests {
.setSource(searchSource().query(matchAllQuery()).buildAsBytes())
.get();
if (countResponse.getCount() != 1){
SearchResponse actionResponse = client().prepareSearch(AlertActionManager.ALERT_HISTORY_INDEX)
.setQuery(matchAllQuery())
.get();
for (SearchHit hit : actionResponse.getHits()) {
logger.info("Got action hit [{}]", hit.getSourceRef().toUtf8());
}
}
assertThat(countResponse.getCount(), equalTo(1L));
Thread.sleep(15*1000);