Skip to content

Commit 2c4349b

Browse files
authored
Tests: fix testBulkProcessorConcurrentRequestsReadOnlyIndex (#64633) (#64658)
Executing a MultiGetRequest with no items will fail. This makes sure there is always at least one item in the request. (cherry picked from commit bd47032) Signed-off-by: Andrei Dan <[email protected]>
1 parent d746eee commit 2c4349b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

client/rest-high-level/src/test/java/org/elasticsearch/client/BulkProcessorIT.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,8 @@ public void testBulkProcessorConcurrentRequestsReadOnlyIndex() throws Exception
248248
.setFlushInterval(TimeValue.timeValueHours(24)).setBulkSize(new ByteSizeValue(1, ByteSizeUnit.GB)).build()) {
249249

250250
for (int i = 1; i <= numDocs; i++) {
251-
if (randomBoolean()) {
251+
// let's make sure we get at least 1 item in the MultiGetRequest regardless of the randomising roulette
252+
if (randomBoolean() || multiGetRequest.getItems().size() == 0) {
252253
testDocs++;
253254
processor.add(new IndexRequest("test").id(Integer.toString(testDocs))
254255
.source(XContentType.JSON, "field", "value"));

0 commit comments

Comments
 (0)