From 5864f30771684871ded0e9158de4f700ff3b6453 Mon Sep 17 00:00:00 2001 From: Martijn van Groningen Date: Wed, 21 Aug 2019 10:06:26 +0200 Subject: [PATCH] ensure that the items in the bulk response are the same as is in the bulk request --- .../org/elasticsearch/xpack/enrich/BasicEnrichTests.java | 5 +++++ .../org/elasticsearch/xpack/enrich/EnrichMultiNodeIT.java | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/x-pack/plugin/enrich/src/test/java/org/elasticsearch/xpack/enrich/BasicEnrichTests.java b/x-pack/plugin/enrich/src/test/java/org/elasticsearch/xpack/enrich/BasicEnrichTests.java index 19ced176c52..bfcdd15cab8 100644 --- a/x-pack/plugin/enrich/src/test/java/org/elasticsearch/xpack/enrich/BasicEnrichTests.java +++ b/x-pack/plugin/enrich/src/test/java/org/elasticsearch/xpack/enrich/BasicEnrichTests.java @@ -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(); diff --git a/x-pack/plugin/enrich/src/test/java/org/elasticsearch/xpack/enrich/EnrichMultiNodeIT.java b/x-pack/plugin/enrich/src/test/java/org/elasticsearch/xpack/enrich/EnrichMultiNodeIT.java index 7c649d9c9a3..fe551004d71 100644 --- a/x-pack/plugin/enrich/src/test/java/org/elasticsearch/xpack/enrich/EnrichMultiNodeIT.java +++ b/x-pack/plugin/enrich/src/test/java/org/elasticsearch/xpack/enrich/EnrichMultiNodeIT.java @@ -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();