Skip to content

Commit

Permalink
fixing TransportShardBulkActionTests
Browse files Browse the repository at this point in the history
  • Loading branch information
masseyke committed Jan 3, 2024
1 parent 511c154 commit 4a02df7
Showing 1 changed file with 27 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1158,28 +1158,33 @@ public void testNoopMappingUpdateInfiniteLoopPrevention() throws Exception {
BulkItemRequest[] items = new BulkItemRequest[] {
new BulkItemRequest(0, new UpdateRequest("index", "id").doc(Requests.INDEX_CONTENT_TYPE, "field", "value")) };
BulkShardRequest bulkShardRequest = new BulkShardRequest(shardId, RefreshPolicy.NONE, items);

AssertionError error = expectThrows(
AssertionError.class,
() -> TransportShardBulkAction.performOnPrimary(
bulkShardRequest,
shard,
updateHelper,
threadPool::absoluteTimeInMillis,
(update, shardId, listener) -> fail("the master should not be contacted as the operation yielded a noop mapping update"),
listener -> listener.onResponse(null),
ActionTestUtils.assertNoFailureListener(result -> {}),
threadPool,
Names.WRITE
)
);
assertThat(
error.getMessage(),
equalTo(
"On retry, this indexing request resulted in another noop mapping update."
+ " Failing the indexing operation to prevent an infinite retry loop."
)
);
try {
AssertionError error = expectThrows(
AssertionError.class,
() -> TransportShardBulkAction.performOnPrimary(
bulkShardRequest,
shard,
updateHelper,
threadPool::absoluteTimeInMillis,
(update, shardId, listener) -> fail(
"the master should not be contacted as the operation yielded a noop mapping update"
),
listener -> listener.onResponse(null),
ActionTestUtils.assertNoFailureListener(result -> {}),
threadPool,
Names.WRITE
)
);
assertThat(
error.getMessage(),
equalTo(
"On retry, this indexing request resulted in another noop mapping update."
+ " Failing the indexing operation to prevent an infinite retry loop."
)
);
} finally {
bulkShardRequest.decRef();
}
}

public void testNoopMappingUpdateSuccessOnRetry() throws Exception {
Expand Down

0 comments on commit 4a02df7

Please sign in to comment.