Skip to content

Commit 464c88d

Browse files
committed
Fix Flaky Test testPendingTasksWithClusterNotRecoveredBlock
Signed-off-by: kkewwei <[email protected]> Signed-off-by: kkewwei <[email protected]>
1 parent 1b7c055 commit 464c88d

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

server/src/internalClusterTest/java/org/opensearch/action/admin/cluster/tasks/PendingTasksBlocksIT.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232

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

35+
import org.opensearch.action.admin.cluster.node.info.NodesInfoRequest;
3536
import org.opensearch.common.settings.Settings;
3637
import org.opensearch.gateway.GatewayService;
3738
import org.opensearch.test.InternalTestCluster;
@@ -91,11 +92,12 @@ public void testPendingTasksWithClusterNotRecoveredBlock() throws Exception {
9192
}
9293

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

101103
@Override

0 commit comments

Comments
 (0)