소스 검색

Fix DiscoveryDisruptionIT.testElectMasterWithLatestVersion (#135396) (#135435)

The clusterAdmin() call at the end of the test uses a random node,
which may not have been part of the current election, and may still
have an old cluster state, prior to the creation of the index in the
test.  The fix ensures we use the admin client for the master node.

Resolves: #134748
Jeremy Dahlgren 2 주 전
부모
커밋
83b214e8b6
1개의 변경된 파일2개의 추가작업 그리고 1개의 파일을 삭제
  1. 2 1
      server/src/internalClusterTest/java/org/elasticsearch/discovery/DiscoveryDisruptionIT.java

+ 2 - 1
server/src/internalClusterTest/java/org/elasticsearch/discovery/DiscoveryDisruptionIT.java

@@ -147,7 +147,8 @@ public class DiscoveryDisruptionIT extends AbstractDisruptionTestCase {
         isolateAllNodes.stopDisrupting();
 
         awaitMasterNode();
-        final ClusterState state = clusterAdmin().prepareState(TEST_REQUEST_TIMEOUT).get().getState();
+        final var masterNodeAdminClient = client(internalCluster().getMasterName()).admin().cluster();
+        final ClusterState state = masterNodeAdminClient.prepareState(TEST_REQUEST_TIMEOUT).get().getState();
         if (state.metadata().getProject().hasIndex("test") == false) {
             fail("index 'test' was lost. current cluster state: " + state);
         }