Skip to content

Commit d8955de

Browse files
committed
Test
1 parent da900b1 commit d8955de

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

server/src/test/java/org/elasticsearch/rest/action/document/RestBulkActionTests.java

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,11 @@
4242
import static org.hamcrest.Matchers.empty;
4343
import static org.hamcrest.Matchers.equalTo;
4444
import static org.hamcrest.Matchers.hasSize;
45+
import static org.mockito.ArgumentMatchers.anyBoolean;
46+
import static org.mockito.ArgumentMatchers.anyInt;
47+
import static org.mockito.ArgumentMatchers.anyLong;
4548
import static org.mockito.Mockito.mock;
49+
import static org.mockito.Mockito.when;
4650

4751
/**
4852
* Tests for {@link RestBulkAction}.
@@ -224,10 +228,12 @@ public void next() {
224228
.build();
225229
FakeRestChannel channel = new FakeRestChannel(request, randomBoolean(), 1);
226230

227-
RestBulkAction.ChunkHandler chunkHandler = new RestBulkAction.ChunkHandler(
228-
true,
229-
request,
230-
() -> new IncrementalBulkService.Handler(null, null, null, null, null) {
231+
IndexingPressure indexingPressure = mock(IndexingPressure.class);
232+
when(indexingPressure.markCoordinatingOperationStarted(anyInt(), anyLong(), anyBoolean())).thenReturn(
233+
mock(IndexingPressure.Coordinating.class)
234+
);
235+
RestBulkAction.ChunkHandler chunkHandler = new RestBulkAction.ChunkHandler(true, request, () -> {
236+
return new IncrementalBulkService.Handler(null, indexingPressure, null, null, null) {
231237

232238
@Override
233239
public void addItems(List<DocWriteRequest<?>> items, Releasable releasable, Runnable nextItems) {
@@ -241,8 +247,8 @@ public void lastItems(List<DocWriteRequest<?>> items, Releasable releasable, Act
241247
docs.addAll(items);
242248
isLast.set(true);
243249
}
244-
}
245-
);
250+
};
251+
});
246252

247253
chunkHandler.accept(channel);
248254
ReleasableBytesReference r1 = new ReleasableBytesReference(new BytesArray("{\"index\":{\"_index\":\"index_name\"}}\n"), () -> {});

0 commit comments

Comments
 (0)