Skip to content

Commit 712c2c6

Browse files
Fix DiscoveryDisruptionIT.testElectMasterWithLatestVersion
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 8a10ffa commit 712c2c6

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
@@ -516,9 +516,6 @@ tests:
516516
- class: org.elasticsearch.xpack.esql.expression.function.scalar.score.DecayTests
517517
method: "testEvaluateBlockWithNulls {TestCase=<integer>, <integer>, <integer>, <_source> #2}"
518518
issue: https://github.com/elastic/elasticsearch/issues/134679
519-
- class: org.elasticsearch.discovery.DiscoveryDisruptionIT
520-
method: testElectMasterWithLatestVersion
521-
issue: https://github.com/elastic/elasticsearch/issues/134748
522519
- class: org.elasticsearch.xpack.esql.ccq.MultiClusterSpecIT
523520
method: test {csv-spec:fork.ForkBeforeStatsByWithWhere}
524521
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)