Skip to content

Commit e650f67

Browse files
Fix DiscoveryDisruptionIT.testElectMasterWithLatestVersion (elastic#135396)
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: elastic#134748 (cherry picked from commit 119c682) # Conflicts: # muted-tests.yml
1 parent da727f0 commit e650f67

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)