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:
Ryan Ernst 2017-06-03 16:55:34 -07:00 committed by GitHub
parent 134b0d594e
commit e22a68295c
1 changed files with 5 additions and 0 deletions

View File

@ -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");