File tree Expand file tree Collapse file tree 1 file changed +5
-1
lines changed
test/framework/src/main/java/org/elasticsearch/test Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -2040,7 +2040,11 @@ public String getMasterName(@Nullable String viaNode) {
20402040 try {
20412041 ClusterServiceUtils .awaitClusterState (logger , state -> state .nodes ().getMasterNode () != null , clusterService (viaNode ));
20422042 final ClusterState state = client (viaNode ).admin ().cluster ().prepareState (TEST_REQUEST_TIMEOUT ).setLocal (true ).get ().getState ();
2043- return state .nodes ().getMasterNode ().getName ();
2043+ final DiscoveryNode masterNode = state .nodes ().getMasterNode ();
2044+ if (masterNode == null ) {
2045+ throw new AssertionError ("Master is not stable but the method expects a stable master node" );
2046+ }
2047+ return masterNode .getName ();
20442048 } catch (Exception e ) {
20452049 logger .warn ("Can't fetch cluster state" , e );
20462050 throw new RuntimeException ("Can't get master node " + e .getMessage (), e );
You can’t perform that action at this time.
0 commit comments