diff --git a/plugin/src/test/java/org/elasticsearch/xpack/ml/support/BaseMlIntegTestCase.java b/plugin/src/test/java/org/elasticsearch/xpack/ml/support/BaseMlIntegTestCase.java index 02a267fcccb..5d33ddd41e5 100644 --- a/plugin/src/test/java/org/elasticsearch/xpack/ml/support/BaseMlIntegTestCase.java +++ b/plugin/src/test/java/org/elasticsearch/xpack/ml/support/BaseMlIntegTestCase.java @@ -7,6 +7,7 @@ package org.elasticsearch.xpack.ml.support; import org.apache.logging.log4j.Logger; import org.elasticsearch.action.admin.indices.recovery.RecoveryResponse; +import org.elasticsearch.action.bulk.BulkItemResponse; import org.elasticsearch.action.bulk.BulkRequestBuilder; import org.elasticsearch.action.bulk.BulkResponse; import org.elasticsearch.action.index.IndexRequest; @@ -50,7 +51,6 @@ import java.util.Map; import java.util.concurrent.ExecutionException; import static org.hamcrest.Matchers.equalTo; -import static org.hamcrest.Matchers.is; /** * A base class for testing datafeed and job lifecycle specifics. @@ -209,7 +209,16 @@ public abstract class BaseMlIntegTestCase extends ESIntegTestCase { BulkResponse bulkResponse = bulkRequestBuilder .setRefreshPolicy(WriteRequest.RefreshPolicy.IMMEDIATE) .get(); - assertThat(bulkResponse.hasFailures(), is(false)); + if (bulkResponse.hasFailures()) { + int failures = 0; + for (BulkItemResponse itemResponse : bulkResponse) { + if (itemResponse.isFailed()) { + failures++; + logger.error("Item response failure [{}]", itemResponse.getFailureMessage()); + } + } + fail("Bulk response contained " + failures + " failures"); + } logger.info("Indexed [{}] documents", numDocs); }