Tests: Make secure settings available from settings builder for tests (#25037)
This commit exposes the secure settings in Settings.Builder, so that the current secure settings can be retrieved and added to when creating settings for tests. This is necessary since secure settings can only be added once to a builder, so chains of methods using settings builders must reuse the already set mock secure settings.
This commit is contained in:
parent
134b0d594e
commit
e22a68295c
|
@ -721,6 +721,11 @@ public final class Settings implements ToXContent {
|
|||
return map.get(key);
|
||||
}
|
||||
|
||||
/** Return the current secure settings, or {@code null} if none have been set. */
|
||||
public SecureSettings getSecureSettings() {
|
||||
return secureSettings.get();
|
||||
}
|
||||
|
||||
public Builder setSecureSettings(SecureSettings secureSettings) {
|
||||
if (secureSettings.isLoaded() == false) {
|
||||
throw new IllegalStateException("Secure settings must already be loaded");
|
||||
|
|
Loading…
Reference in New Issue