Skip to content

Commit ee6d64a

Browse files
[Test] Fix FileSettingsRoleMappingsRestartIT (#129618)
The #127318 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. Additionally it awaits for the master node to process all cluster state events before proceeding, which should hopefully solve the original cause of failures. Resolves #120964 Resolves #120923
1 parent 9cc034b commit ee6d64a

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
@@ -152,9 +152,6 @@ tests:
152152
- class: org.elasticsearch.packaging.test.DockerTests
153153
method: test140CgroupOsStatsAreAvailable
154154
issue: https://github.com/elastic/elasticsearch/issues/120914
155-
- class: org.elasticsearch.xpack.security.FileSettingsRoleMappingsRestartIT
156-
method: testReservedStatePersistsOnRestart
157-
issue: https://github.com/elastic/elasticsearch/issues/120923
158155
- class: org.elasticsearch.packaging.test.DockerTests
159156
method: test070BindMountCustomPathConfAndJvmOptions
160157
issue: https://github.com/elastic/elasticsearch/issues/120910
@@ -167,9 +164,6 @@ tests:
167164
- class: org.elasticsearch.backwards.MixedClusterClientYamlTestSuiteIT
168165
method: test {p0=nodes.stats/11_indices_metrics/indices mappings exact count test for indices level}
169166
issue: https://github.com/elastic/elasticsearch/issues/120950
170-
- class: org.elasticsearch.xpack.security.FileSettingsRoleMappingsRestartIT
171-
method: testFileSettingsReprocessedOnRestartWithoutVersionChange
172-
issue: https://github.com/elastic/elasticsearch/issues/120964
173167
- class: org.elasticsearch.xpack.ml.integration.PyTorchModelIT
174168
issue: https://github.com/elastic/elasticsearch/issues/121165
175169
- 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();
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();
197199

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

0 commit comments

Comments
 (0)