Skip to content

Commit 119c682

Browse files
Fix DiscoveryDisruptionIT.testElectMasterWithLatestVersion (#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: #134748
1 parent 203df4e commit 119c682

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

muted-tests.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -513,9 +513,6 @@ tests:
513513
- class: org.elasticsearch.xpack.esql.expression.function.scalar.score.DecayTests
514514
method: "testEvaluateBlockWithNulls {TestCase=<integer>, <integer>, <integer>, <_source> #2}"
515515
issue: https://github.com/elastic/elasticsearch/issues/134679
516-
- class: org.elasticsearch.discovery.DiscoveryDisruptionIT
517-
method: testElectMasterWithLatestVersion
518-
issue: https://github.com/elastic/elasticsearch/issues/134748
519516
- class: org.elasticsearch.xpack.esql.ccq.MultiClusterSpecIT
520517
method: test {csv-spec:fork.ForkBeforeStatsByWithWhere}
521518
issue: https://github.com/elastic/elasticsearch/issues/134817

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)