Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wait on AsynchronousSearchStatsRequest before asserting on statsResponse #617

Merged
merged 1 commit into from
Sep 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public class SubmitAsynchronousSearchRequest extends ActionRequest {
private TimeValue waitForCompletionTimeout = DEFAULT_WAIT_FOR_COMPLETION_TIMEOUT;

/**
* Determines whether the resource resource should be kept on completion or failure (defaults to false).
* Determines whether the resource should be kept on completion or failure (defaults to false).
*/
@Nullable
private Boolean keepOnCompletion = DEFAULT_KEEP_ON_COMPLETION;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,11 +166,15 @@ public void testStatsAcrossNodes() throws InterruptedException, ExecutionExcepti
TestThreadPool finalThreadPool = threadPool;
threads.forEach(t -> finalThreadPool.generic().execute(t));
latch.await();
AsynchronousSearchStatsResponse statsResponse = client().execute(AsynchronousSearchStatsAction.INSTANCE,
new AsynchronousSearchStatsRequest()).get();

AtomicLong actualNumSuccesses = new AtomicLong();
AtomicLong actualNumFailures = new AtomicLong();
AtomicLong actualNumPersisted = new AtomicLong();

AsynchronousSearchStatsResponse statsResponse = client().execute(AsynchronousSearchStatsAction.INSTANCE,
new AsynchronousSearchStatsRequest()).get();
waitForAsyncSearchTasksToComplete();
finnegancarroll marked this conversation as resolved.
Show resolved Hide resolved

for (AsynchronousSearchStats node : statsResponse.getNodes()) {
AsynchronousSearchCountStats asCountStats = node.getAsynchronousSearchCountStats();
assertEquals(asCountStats.getRunningCount(), 0);
Expand All @@ -188,7 +192,6 @@ public void testStatsAcrossNodes() throws InterruptedException, ExecutionExcepti
assertEquals(expectedNumPersisted.get(), actualNumPersisted.get());
assertEquals(expectedNumFailures.get(), actualNumFailures.get());
assertEquals(expectedNumSuccesses.get(), actualNumSuccesses.get());
waitForAsyncSearchTasksToComplete();
} finally {
ThreadPool.terminate(threadPool, 10, TimeUnit.SECONDS);
}
Expand Down
Loading