Test: use the same settings object to construct tribe settings
This changes the SecurityTribeIT tests to use the same settings object when creating the settings for the tribe node. Previously two different objects were being created and we would read regular settings from one and secure settings from another. This causes problems since randomization means that there may be settings added on the first call that do not get added on the second call. One example is the randomization of when to only use a keystore or to use both a keystore and a truststore. On the first call, we would add settings for both a keystore and a truststore but on the second call only the keystore settings were added. This lead to failures as we would not be able to open a password protected truststore since the password was never added to the secure settings. relates elastic/x-pack-elasticsearch#2005 Original commit: elastic/x-pack-elasticsearch@bbdb3ec662
This commit is contained in:
parent
49407c1069
commit
1a6e6411cf
|
@ -160,8 +160,9 @@ public class SecurityTribeIT extends NativeRealmIntegTestCase {
|
|||
.build();
|
||||
}
|
||||
};
|
||||
final Settings settingsTemplate = cluster2SettingsSource.nodeSettings(0);
|
||||
|
||||
Map<String, String> asMap = new HashMap<>(cluster2SettingsSource.nodeSettings(0).getAsMap());
|
||||
Map<String, String> asMap = new HashMap<>(settingsTemplate.getAsMap());
|
||||
asMap.remove(NodeEnvironment.MAX_LOCAL_STORAGE_NODES_SETTING.getKey());
|
||||
Settings.Builder tribe1Defaults = Settings.builder();
|
||||
Settings.Builder tribe2Defaults = Settings.builder();
|
||||
|
@ -176,7 +177,7 @@ public class SecurityTribeIT extends NativeRealmIntegTestCase {
|
|||
}
|
||||
// TODO: rethink how these settings are generated for tribes once we support more than just string settings...
|
||||
MockSecureSettings secureSettingsTemplate =
|
||||
(MockSecureSettings) Settings.builder().put(cluster2SettingsSource.nodeSettings(0)).getSecureSettings();
|
||||
(MockSecureSettings) Settings.builder().put(settingsTemplate).getSecureSettings();
|
||||
MockSecureSettings secureSettings = new MockSecureSettings();
|
||||
if (secureSettingsTemplate != null) {
|
||||
for (String settingName : secureSettingsTemplate.getSettingNames()) {
|
||||
|
|
Loading…
Reference in New Issue