Skip to content

Commit

Permalink
fixing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
masseyke committed Dec 4, 2023
1 parent 4f43e4b commit 5bcbb92
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -184,11 +184,12 @@ private static void ensureSearchTaskIsCancelled(String transportAction, Function
private static void indexTestData() {
for (int i = 0; i < 5; i++) {
// Make sure we have a few segments
BulkRequestBuilder bulkRequestBuilder = client().prepareBulk().setRefreshPolicy(WriteRequest.RefreshPolicy.IMMEDIATE);
for (int j = 0; j < 20; j++) {
bulkRequestBuilder.add(prepareIndex("test").setId(Integer.toString(i * 5 + j)).setSource("field", "value"));
try (BulkRequestBuilder bulkRequestBuilder = client().prepareBulk().setRefreshPolicy(WriteRequest.RefreshPolicy.IMMEDIATE)) {
for (int j = 0; j < 20; j++) {
bulkRequestBuilder.add(prepareIndex("test").setId(Integer.toString(i * 5 + j)).setSource("field", "value"));
}
assertNoFailures(bulkRequestBuilder.get());
}
assertNoFailures(bulkRequestBuilder.get());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,11 @@ protected <Request extends ActionRequest, Response extends ActionResponse> void
((Runnable) inv.getArguments()[1]).run();
return null;
}).when(securityIndex).prepareIndexIfNeededThenExecute(anyConsumer(), any(Runnable.class));
doAnswer(inv -> {
((Runnable) inv.getArguments()[1]).run();
((Runnable) inv.getArguments()[2]).run();
return null;
}).when(securityIndex).prepareIndexIfNeededThenExecute(anyConsumer(), any(Runnable.class), any(Runnable.class));
doAnswer(inv -> {
((Runnable) inv.getArguments()[1]).run();
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,8 @@ public static SecurityIndexManager mockSecurityIndexManager(String alias, boolea
doAnswer(invocationOnMock -> {
Runnable runnable = (Runnable) invocationOnMock.getArguments()[1];
runnable.run();
Runnable onCompletion = (Runnable) invocationOnMock.getArguments()[2];
onCompletion.run();
return null;
}).when(securityIndexManager).prepareIndexIfNeededThenExecute(anyConsumer(), any(Runnable.class), any(Runnable.class));
}).when(securityIndexManager).prepareIndexIfNeededThenExecute(anyConsumer(), any(Runnable.class));
doAnswer(invocationOnMock -> {
Runnable runnable = (Runnable) invocationOnMock.getArguments()[1];
runnable.run();
Expand Down

0 comments on commit 5bcbb92

Please sign in to comment.