Skip to content

Commit

Permalink
Fix Flaky Test testPendingTasksWithClusterNotRecoveredBlock
Browse files Browse the repository at this point in the history
Signed-off-by: kkewwei <[email protected]>
Signed-off-by: kkewwei <[email protected]>
  • Loading branch information
kkewwei committed Feb 20, 2025
1 parent c34cedc commit 17a63ef
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@

package org.opensearch.action.admin.cluster.tasks;

import org.opensearch.action.admin.cluster.node.info.NodesInfoRequest;
import org.opensearch.common.settings.Settings;
import org.opensearch.gateway.GatewayService;
import org.opensearch.test.InternalTestCluster;
Expand Down Expand Up @@ -91,11 +92,12 @@ public void testPendingTasksWithClusterNotRecoveredBlock() throws Exception {
}

// restart the cluster but prevent it from performing state recovery
final int nodeCount = client().admin().cluster().prepareNodesInfo("data:true", "cluster_manager:true").get().getNodes().size();
NodesInfoRequest nodesInfoRequest = new NodesInfoRequest();
final int dataNodesCount = client().admin().cluster().prepareNodesInfo("data:true").get().getNodes().size();
internalCluster().fullRestart(new InternalTestCluster.RestartCallback() {
@Override
public Settings onNodeStopped(String nodeName) {
return Settings.builder().put(GatewayService.RECOVER_AFTER_DATA_NODES_SETTING.getKey(), nodeCount + 1).build();
return Settings.builder().put(GatewayService.RECOVER_AFTER_DATA_NODES_SETTING.getKey(), dataNodesCount + 1).build();
}

@Override
Expand Down

0 comments on commit 17a63ef

Please sign in to comment.