Skip to content

Commit

Permalink
fixing EnrichMultiNodeIT
Browse files Browse the repository at this point in the history
  • Loading branch information
masseyke committed Nov 30, 2023
1 parent 3bfe9a5 commit ab77f83
Showing 1 changed file with 14 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -211,19 +211,20 @@ public void testExecutePolicyNeverOnElectedMaster() throws Exception {

private static void enrich(List<String> keys, String coordinatingNode) {
int numDocs = 256;
BulkRequest bulkRequest = new BulkRequest("my-index");
for (int i = 0; i < numDocs; i++) {
IndexRequest indexRequest = new IndexRequest();
indexRequest.id(Integer.toString(i));
indexRequest.setPipeline(PIPELINE_NAME);
indexRequest.source(Map.of(MATCH_FIELD, randomFrom(keys)));
bulkRequest.add(indexRequest);
}
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++)));
try (BulkRequest bulkRequest = new BulkRequest("my-index")) {
for (int i = 0; i < numDocs; i++) {
IndexRequest indexRequest = new IndexRequest();
indexRequest.id(Integer.toString(i));
indexRequest.setPipeline(PIPELINE_NAME);
indexRequest.source(Map.of(MATCH_FIELD, randomFrom(keys)));
bulkRequest.add(indexRequest);
}
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++) {
Expand Down

0 comments on commit ab77f83

Please sign in to comment.