diff --git a/src/test/java/com/amazon/opendistroforelasticsearch/security/test/AbstractSecurityUnitTest.java b/src/test/java/com/amazon/opendistroforelasticsearch/security/test/AbstractSecurityUnitTest.java index 0edf7de93e..7bd2a5613e 100644 --- a/src/test/java/com/amazon/opendistroforelasticsearch/security/test/AbstractSecurityUnitTest.java +++ b/src/test/java/com/amazon/opendistroforelasticsearch/security/test/AbstractSecurityUnitTest.java @@ -219,7 +219,7 @@ protected void initialize(ClusterInfo info, Settings initTransportClientSettings } } - protected Settings.Builder minimumSecuritySettingsBuilder(int node, boolean sslOnly, boolean hasCustomTransportSettings) { + protected Settings.Builder minimumSecuritySettingsBuilder(int node, boolean sslOnly, Settings other) { final String prefix = getResourceFolder()==null?"":getResourceFolder()+"/"; @@ -228,7 +228,7 @@ protected Settings.Builder minimumSecuritySettingsBuilder(int node, boolean sslO .put(SSLConfigConstants.OPENDISTRO_SECURITY_SSL_TRANSPORT_ENABLE_OPENSSL_IF_AVAILABLE, allowOpenSSL); // If custom transport settings are not defined use defaults - if (!hasCustomTransportSettings) { + if (!hasCustomTransportSettings(other)) { builder.put(SSLConfigConstants.OPENDISTRO_SECURITY_SSL_TRANSPORT_KEYSTORE_ALIAS, "node-0") .put(SSLConfigConstants.OPENDISTRO_SECURITY_SSL_TRANSPORT_KEYSTORE_FILEPATH, FileHelper.getAbsoluteFilePathFromClassPath(prefix+"node-0-keystore.jks")) @@ -241,6 +241,8 @@ protected Settings.Builder minimumSecuritySettingsBuilder(int node, boolean sslO builder.put(ConfigConstants.OPENDISTRO_SECURITY_BACKGROUND_INIT_IF_SECURITYINDEX_NOT_EXIST, false); } + builder.put(other); + return builder; } @@ -248,7 +250,7 @@ protected NodeSettingsSupplier minimumSecuritySettings(Settings other) { return new NodeSettingsSupplier() { @Override public Settings get(int i) { - return minimumSecuritySettingsBuilder(i, false, hasCustomTransportSettings(other)).put(other).build(); + return minimumSecuritySettingsBuilder(i, false, other).build(); } }; } @@ -258,7 +260,7 @@ protected NodeSettingsSupplier minimumSecuritySettingsSslOnly(Settings other) { return new NodeSettingsSupplier() { @Override public Settings get(int i) { - return minimumSecuritySettingsBuilder(i, true, false).put(other).build(); + return minimumSecuritySettingsBuilder(i, true, other).build(); } }; } @@ -271,7 +273,7 @@ public Settings get(int i) { if (i == nonSSLNodeNum) { return Settings.builder().build(); } - return minimumSecuritySettingsBuilder(i, true, false).put(other).build(); + return minimumSecuritySettingsBuilder(i, true, other).build(); } }; }