فهرست منبع

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);
         }