Skip to content

Commit 83b214e

Browse files
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
1 parent 31f0ba4 commit 83b214e

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

server/src/internalClusterTest/java/org/elasticsearch/discovery/DiscoveryDisruptionIT.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,8 @@ public void testElectMasterWithLatestVersion() throws Exception {
147147
isolateAllNodes.stopDisrupting();
148148

149149
awaitMasterNode();
150-
final ClusterState state = clusterAdmin().prepareState(TEST_REQUEST_TIMEOUT).get().getState();
150+
final var masterNodeAdminClient = client(internalCluster().getMasterName()).admin().cluster();
151+
final ClusterState state = masterNodeAdminClient.prepareState(TEST_REQUEST_TIMEOUT).get().getState();
151152
if (state.metadata().getProject().hasIndex("test") == false) {
152153
fail("index 'test' was lost. current cluster state: " + state);
153154
}

0 commit comments

Comments
 (0)