use of org.opensearch.cluster.ClusterState.Builder in project OpenSearch by opensearch-project.
the class TransportClearVotingConfigExclusionsActionTests method testSucceedsIfNodesAreRemovedWhileWaiting.
public void testSucceedsIfNodesAreRemovedWhileWaiting() throws InterruptedException {
final CountDownLatch countDownLatch = new CountDownLatch(1);
final SetOnce<ClearVotingConfigExclusionsResponse> responseHolder = new SetOnce<>();
transportService.sendRequest(localNode, ClearVotingConfigExclusionsAction.NAME, new ClearVotingConfigExclusionsRequest(), expectSuccess(r -> {
responseHolder.set(r);
countDownLatch.countDown();
}));
final ClusterState.Builder builder = builder(clusterService.state());
builder.nodes(DiscoveryNodes.builder(clusterService.state().nodes()).remove(otherNode1).remove(otherNode2));
setState(clusterService, builder);
assertTrue(countDownLatch.await(30, TimeUnit.SECONDS));
assertThat(clusterService.getClusterApplierService().state().getVotingConfigExclusions(), empty());
}
Aggregations