ensure that the items in the bulk response are the same as is in the bulk request

This commit is contained in:
Martijn van Groningen 2019-08-21 10:06:26 +02:00
parent ac7173c0d4
commit 5864f30771
No known key found for this signature in database
GPG Key ID: AB236F4FCF2AF12A
2 changed files with 10 additions and 0 deletions

View File

@ -6,6 +6,7 @@
package org.elasticsearch.xpack.enrich;
import org.elasticsearch.action.admin.indices.refresh.RefreshRequest;
import org.elasticsearch.action.bulk.BulkItemResponse;
import org.elasticsearch.action.bulk.BulkRequest;
import org.elasticsearch.action.bulk.BulkResponse;
import org.elasticsearch.action.get.GetRequest;
@ -74,6 +75,10 @@ public class BasicEnrichTests extends ESSingleNodeTestCase {
}
BulkResponse bulkResponse = client().bulk(bulkRequest).actionGet();
assertThat("Expected no failure, but " + bulkResponse.buildFailureMessage(), bulkResponse.hasFailures(), is(false));
int expectedId = 0;
for (BulkItemResponse itemResponse : bulkResponse) {
assertThat(itemResponse.getId(), equalTo(Integer.toString(expectedId++)));
}
for (int i = 0; i < numDocs; i++) {
GetResponse getResponse = client().get(new GetRequest("my-index", Integer.toString(i))).actionGet();

View File

@ -7,6 +7,7 @@ package org.elasticsearch.xpack.enrich;
import org.apache.lucene.search.TotalHits;
import org.elasticsearch.action.admin.indices.refresh.RefreshRequest;
import org.elasticsearch.action.bulk.BulkItemResponse;
import org.elasticsearch.action.bulk.BulkRequest;
import org.elasticsearch.action.bulk.BulkResponse;
import org.elasticsearch.action.get.GetRequest;
@ -140,6 +141,10 @@ public class EnrichMultiNodeIT extends ESIntegTestCase {
}
BulkResponse bulkResponse = client(coordinatingNode).bulk(bulkRequest).actionGet();
assertThat("Expected no failure, but " + bulkResponse.buildFailureMessage(), bulkResponse.hasFailures(), is(false));
int expectedId = 0;
for (BulkItemResponse itemResponse : bulkResponse) {
assertThat(itemResponse.getId(), equalTo(Integer.toString(expectedId++)));
}
for (int i = 0; i < numDocs; i++) {
GetResponse getResponse = client().get(new GetRequest("my-index", Integer.toString(i))).actionGet();