From a6fc1e5e8e59b5c617dde9f81aaaebb27c04b22a Mon Sep 17 00:00:00 2001 From: Slobodan Adamovic Date: Wed, 18 Jun 2025 11:56:19 +0200 Subject: [PATCH 1/2] [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 --- muted-tests.yml | 6 ------ .../xpack/security/FileSettingsRoleMappingsRestartIT.java | 6 ++++-- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/muted-tests.yml b/muted-tests.yml index 605f858206e07..83ffb778a19f9 100644 --- a/muted-tests.yml +++ b/muted-tests.yml @@ -158,9 +158,6 @@ tests: - class: org.elasticsearch.packaging.test.DockerTests method: test140CgroupOsStatsAreAvailable issue: https://github.com/elastic/elasticsearch/issues/120914 -- class: org.elasticsearch.xpack.security.FileSettingsRoleMappingsRestartIT - method: testReservedStatePersistsOnRestart - issue: https://github.com/elastic/elasticsearch/issues/120923 - class: org.elasticsearch.packaging.test.DockerTests method: test070BindMountCustomPathConfAndJvmOptions issue: https://github.com/elastic/elasticsearch/issues/120910 @@ -173,9 +170,6 @@ tests: - class: org.elasticsearch.backwards.MixedClusterClientYamlTestSuiteIT method: test {p0=nodes.stats/11_indices_metrics/indices mappings exact count test for indices level} issue: https://github.com/elastic/elasticsearch/issues/120950 -- class: org.elasticsearch.xpack.security.FileSettingsRoleMappingsRestartIT - method: testFileSettingsReprocessedOnRestartWithoutVersionChange - issue: https://github.com/elastic/elasticsearch/issues/120964 - class: org.elasticsearch.xpack.ml.integration.PyTorchModelIT issue: https://github.com/elastic/elasticsearch/issues/121165 - class: org.elasticsearch.xpack.security.authc.ldap.ActiveDirectorySessionFactoryTests diff --git a/x-pack/plugin/security/src/internalClusterTest/java/org/elasticsearch/xpack/security/FileSettingsRoleMappingsRestartIT.java b/x-pack/plugin/security/src/internalClusterTest/java/org/elasticsearch/xpack/security/FileSettingsRoleMappingsRestartIT.java index c991316ffc2b9..97f942c033df0 100644 --- a/x-pack/plugin/security/src/internalClusterTest/java/org/elasticsearch/xpack/security/FileSettingsRoleMappingsRestartIT.java +++ b/x-pack/plugin/security/src/internalClusterTest/java/org/elasticsearch/xpack/security/FileSettingsRoleMappingsRestartIT.java @@ -113,7 +113,8 @@ public void resetVersion() { public void testReservedStatePersistsOnRestart() throws Exception { internalCluster().setBootstrapMasterNodeIndex(0); - final String masterNode = internalCluster().getMasterName(); + final String masterNode = internalCluster().startMasterOnlyNode(); + awaitMasterNode(masterNode, masterNode); var savedClusterState = setupClusterStateListener(masterNode, "everyone_kibana_alone"); awaitFileSettingsWatcher(); @@ -193,7 +194,8 @@ public void testReservedStatePersistsOnRestart() throws Exception { public void testFileSettingsReprocessedOnRestartWithoutVersionChange() throws Exception { internalCluster().setBootstrapMasterNodeIndex(0); - final String masterNode = internalCluster().getMasterName(); + final String masterNode = internalCluster().startMasterOnlyNode(); + awaitMasterNode(masterNode, masterNode); Tuple savedClusterState = setupClusterStateListener(masterNode, "everyone_kibana_alone"); awaitFileSettingsWatcher(); From e56770d5129d7c66c911115513da345896108a2d Mon Sep 17 00:00:00 2001 From: Slobodan Adamovic Date: Wed, 18 Jun 2025 12:15:12 +0200 Subject: [PATCH 2/2] use different awaitMasterNode method which waits for all publication --- .../xpack/security/FileSettingsRoleMappingsRestartIT.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/x-pack/plugin/security/src/internalClusterTest/java/org/elasticsearch/xpack/security/FileSettingsRoleMappingsRestartIT.java b/x-pack/plugin/security/src/internalClusterTest/java/org/elasticsearch/xpack/security/FileSettingsRoleMappingsRestartIT.java index 97f942c033df0..e5707d7d16faa 100644 --- a/x-pack/plugin/security/src/internalClusterTest/java/org/elasticsearch/xpack/security/FileSettingsRoleMappingsRestartIT.java +++ b/x-pack/plugin/security/src/internalClusterTest/java/org/elasticsearch/xpack/security/FileSettingsRoleMappingsRestartIT.java @@ -114,7 +114,7 @@ public void testReservedStatePersistsOnRestart() throws Exception { internalCluster().setBootstrapMasterNodeIndex(0); final String masterNode = internalCluster().startMasterOnlyNode(); - awaitMasterNode(masterNode, masterNode); + awaitMasterNode(); var savedClusterState = setupClusterStateListener(masterNode, "everyone_kibana_alone"); awaitFileSettingsWatcher(); @@ -195,7 +195,7 @@ public void testFileSettingsReprocessedOnRestartWithoutVersionChange() throws Ex internalCluster().setBootstrapMasterNodeIndex(0); final String masterNode = internalCluster().startMasterOnlyNode(); - awaitMasterNode(masterNode, masterNode); + awaitMasterNode(); Tuple savedClusterState = setupClusterStateListener(masterNode, "everyone_kibana_alone"); awaitFileSettingsWatcher();