Commit d2c4d60 1 parent 5afb92f commit d2c4d60 Copy full SHA for d2c4d60
File tree 1 file changed +12
-6
lines changed
server/src/internalClusterTest/java/org/opensearch/cluster
1 file changed +12
-6
lines changed Original file line number Diff line number Diff line change 44
44
import org .opensearch .test .OpenSearchIntegTestCase .Scope ;
45
45
46
46
import java .io .IOException ;
47
+ import java .util .function .Supplier ;
47
48
48
49
import static org .opensearch .test .NodeRoles .clusterManagerNode ;
49
50
import static org .opensearch .test .NodeRoles .dataOnlyNode ;
@@ -254,9 +255,9 @@ public void testElectOnlyBetweenClusterManagerNodes() throws Exception {
254
255
logger .info ("--> closing cluster-manager node (1)" );
255
256
client ().execute (AddVotingConfigExclusionsAction .INSTANCE , new AddVotingConfigExclusionsRequest (clusterManagerNodeName )).get ();
256
257
// removing the cluster-manager from the voting configuration immediately triggers the cluster-manager to step down
257
- assertBusy ( () -> {
258
- assertThat (
259
- internalCluster ().nonClusterManagerClient ()
258
+ Supplier < String > getClusterManagerIfElected = () -> {
259
+ try {
260
+ return internalCluster ().nonClusterManagerClient ()
260
261
.admin ()
261
262
.cluster ()
262
263
.prepareState ()
@@ -265,9 +266,14 @@ public void testElectOnlyBetweenClusterManagerNodes() throws Exception {
265
266
.getState ()
266
267
.nodes ()
267
268
.getClusterManagerNode ()
268
- .getName (),
269
- equalTo (nextClusterManagerEligableNodeName )
270
- );
269
+ .getName ();
270
+ } catch (Exception e ) {
271
+ logger .debug ("failed to get cluster-manager name" , e );
272
+ return null ;
273
+ }
274
+ };
275
+ assertBusy (() -> {
276
+ assertThat (getClusterManagerIfElected .get (), equalTo (nextClusterManagerEligableNodeName ));
271
277
assertThat (
272
278
internalCluster ().clusterManagerClient ()
273
279
.admin ()
You can’t perform that action at this time.
0 commit comments