Skip to content

Commit

Permalink
simplify test request usage
Browse files Browse the repository at this point in the history
  • Loading branch information
idegtiarenko committed Oct 26, 2023
1 parent a625fe9 commit ce0c4f7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,7 @@ public void testTasksUnblocking() throws Exception {
)
);

new TestTaskPlugin.UnblockTestTasksRequestBuilder(client(), UNBLOCK_TASK_ACTION).get();
client().execute(UNBLOCK_TASK_ACTION, new TestTaskPlugin.UnblockTestTasksRequest()).get();

future.get();
assertBusy(
Expand Down Expand Up @@ -611,7 +611,7 @@ public void onTaskUnregistered(Task task) {
waitForWaitingToStart.await();
} finally {
// Unblock the request so the wait for completion request can finish
new TestTaskPlugin.UnblockTestTasksRequestBuilder(client(), UNBLOCK_TASK_ACTION).get();
client().execute(UNBLOCK_TASK_ACTION, new TestTaskPlugin.UnblockTestTasksRequest()).get();
}

// Now that the task is unblocked the list response will come back
Expand Down Expand Up @@ -669,7 +669,7 @@ private void waitForTimeoutTestCase(Function<TaskId, ? extends Iterable<? extend
}
} finally {
// Now we can unblock those requests
new TestTaskPlugin.UnblockTestTasksRequestBuilder(client(), UNBLOCK_TASK_ACTION).get();
client().execute(UNBLOCK_TASK_ACTION, new TestTaskPlugin.UnblockTestTasksRequest()).get();
}
future.get();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import org.apache.logging.log4j.Logger;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.ActionRequest;
import org.elasticsearch.action.ActionRequestBuilder;
import org.elasticsearch.action.ActionResponse;
import org.elasticsearch.action.ActionType;
import org.elasticsearch.action.FailedNodeException;
Expand All @@ -25,7 +24,6 @@
import org.elasticsearch.action.support.tasks.BaseTasksRequest;
import org.elasticsearch.action.support.tasks.BaseTasksResponse;
import org.elasticsearch.action.support.tasks.TransportTasksAction;
import org.elasticsearch.client.internal.ElasticsearchClient;
import org.elasticsearch.cluster.ClusterName;
import org.elasticsearch.cluster.node.DiscoveryNode;
import org.elasticsearch.cluster.service.ClusterService;
Expand Down Expand Up @@ -425,13 +423,6 @@ protected void taskOperation(

}

public static class UnblockTestTasksRequestBuilder extends ActionRequestBuilder<UnblockTestTasksRequest, UnblockTestTasksResponse> {

protected UnblockTestTasksRequestBuilder(ElasticsearchClient client, ActionType<UnblockTestTasksResponse> action) {
super(client, action, new UnblockTestTasksRequest());
}
}

private static class OriginAssertingInterceptor implements TransportInterceptor {
private final ThreadContext threadContext;

Expand Down

0 comments on commit ce0c4f7

Please sign in to comment.