Skip to content

Commit a6fc1e5

Browse files
[Test] Fix FileSettingsRoleMappingsRestartIT
The #27318 changed the behaviour of `client()` to not start a node if there is none found in the cluster. Which also changed the `getMasterName()` behaviour to simply fail if there are no nodes instead of starting one. This is why the `getMasterName()` is failing now. There were no nodes started because the test scope is set to manually manage master nodes (`autoManageMasterNodes = false`) without data nodes (`numDataNodes = 0`). The fix is to actually start the master node instead of attempting to get the master node name from an empty cluster and depend on a side effect to actually boostrap a node. Resolves #120964 Resolves #120923
1 parent f62fce9 commit a6fc1e5

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

muted-tests.yml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -158,9 +158,6 @@ tests:
158158
- class: org.elasticsearch.packaging.test.DockerTests
159159
method: test140CgroupOsStatsAreAvailable
160160
issue: https://github.com/elastic/elasticsearch/issues/120914
161-
- class: org.elasticsearch.xpack.security.FileSettingsRoleMappingsRestartIT
162-
method: testReservedStatePersistsOnRestart
163-
issue: https://github.com/elastic/elasticsearch/issues/120923
164161
- class: org.elasticsearch.packaging.test.DockerTests
165162
method: test070BindMountCustomPathConfAndJvmOptions
166163
issue: https://github.com/elastic/elasticsearch/issues/120910
@@ -173,9 +170,6 @@ tests:
173170
- class: org.elasticsearch.backwards.MixedClusterClientYamlTestSuiteIT
174171
method: test {p0=nodes.stats/11_indices_metrics/indices mappings exact count test for indices level}
175172
issue: https://github.com/elastic/elasticsearch/issues/120950
176-
- class: org.elasticsearch.xpack.security.FileSettingsRoleMappingsRestartIT
177-
method: testFileSettingsReprocessedOnRestartWithoutVersionChange
178-
issue: https://github.com/elastic/elasticsearch/issues/120964
179173
- class: org.elasticsearch.xpack.ml.integration.PyTorchModelIT
180174
issue: https://github.com/elastic/elasticsearch/issues/121165
181175
- class: org.elasticsearch.xpack.security.authc.ldap.ActiveDirectorySessionFactoryTests

x-pack/plugin/security/src/internalClusterTest/java/org/elasticsearch/xpack/security/FileSettingsRoleMappingsRestartIT.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,8 @@ public void resetVersion() {
113113
public void testReservedStatePersistsOnRestart() throws Exception {
114114
internalCluster().setBootstrapMasterNodeIndex(0);
115115

116-
final String masterNode = internalCluster().getMasterName();
116+
final String masterNode = internalCluster().startMasterOnlyNode();
117+
awaitMasterNode(masterNode, masterNode);
117118
var savedClusterState = setupClusterStateListener(masterNode, "everyone_kibana_alone");
118119

119120
awaitFileSettingsWatcher();
@@ -193,7 +194,8 @@ public void testReservedStatePersistsOnRestart() throws Exception {
193194
public void testFileSettingsReprocessedOnRestartWithoutVersionChange() throws Exception {
194195
internalCluster().setBootstrapMasterNodeIndex(0);
195196

196-
final String masterNode = internalCluster().getMasterName();
197+
final String masterNode = internalCluster().startMasterOnlyNode();
198+
awaitMasterNode(masterNode, masterNode);
197199

198200
Tuple<CountDownLatch, AtomicLong> savedClusterState = setupClusterStateListener(masterNode, "everyone_kibana_alone");
199201
awaitFileSettingsWatcher();

0 commit comments

Comments
 (0)