Skip to content

Commit 77ab4d1

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 (cherry picked from commit ee6d64a) # Conflicts: # muted-tests.yml
1 parent f4d593a commit 77ab4d1

File tree

2 files changed

+5
-9
lines changed

2 files changed

+5
-9
lines changed

muted-tests.yml

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -173,9 +173,6 @@ tests:
173173
- class: org.elasticsearch.packaging.test.DockerTests
174174
method: test140CgroupOsStatsAreAvailable
175175
issue: https://github.com/elastic/elasticsearch/issues/120914
176-
- class: org.elasticsearch.xpack.security.FileSettingsRoleMappingsRestartIT
177-
method: testReservedStatePersistsOnRestart
178-
issue: https://github.com/elastic/elasticsearch/issues/120923
179176
- class: org.elasticsearch.packaging.test.DockerTests
180177
method: test070BindMountCustomPathConfAndJvmOptions
181178
issue: https://github.com/elastic/elasticsearch/issues/120910
@@ -191,9 +188,6 @@ tests:
191188
- class: org.elasticsearch.xpack.shutdown.AllocationFailuresResetOnShutdownIT
192189
method: testResetAllocationFailuresOnNodeShutdown
193190
issue: https://github.com/elastic/elasticsearch/issues/121129
194-
- class: org.elasticsearch.xpack.security.FileSettingsRoleMappingsRestartIT
195-
method: testFileSettingsReprocessedOnRestartWithoutVersionChange
196-
issue: https://github.com/elastic/elasticsearch/issues/120964
197191
- class: org.elasticsearch.xpack.ml.integration.PyTorchModelIT
198192
issue: https://github.com/elastic/elasticsearch/issues/121165
199193
- class: org.elasticsearch.xpack.test.rest.XPackRestIT
@@ -329,4 +323,4 @@ tests:
329323
# issue: "https://github.com/elastic/elasticsearch/..."
330324
# - class: "org.elasticsearch.xpack.esql.**"
331325
# method: "test {union_types.MultiIndexIpStringStatsInline *}"
332-
# issue: "https://github.com/elastic/elasticsearch/..."
326+
# issue: "https://github.com/elastic/elasticsearch/..."

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
@@ -112,7 +112,8 @@ public void resetVersion() {
112112
public void testReservedStatePersistsOnRestart() throws Exception {
113113
internalCluster().setBootstrapMasterNodeIndex(0);
114114

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

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

195-
final String masterNode = internalCluster().getMasterName();
196+
final String masterNode = internalCluster().startMasterOnlyNode();
197+
awaitMasterNode();
196198

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

0 commit comments

Comments
 (0)