@@ -92,15 +92,7 @@ public abstract class ODFERestTestCase extends OpenSearchRestTestCase {
92
92
private static final Logger LOG = (Logger ) LogManager .getLogger (ODFERestTestCase .class );
93
93
94
94
protected boolean isHttps () {
95
- boolean isHttps = Optional .ofNullable (System .getProperty ("https" )).map ("true" ::equalsIgnoreCase ).orElse (false );
96
- if (isHttps ) {
97
- // currently only external cluster is supported for security enabled testing
98
- if (!Optional .ofNullable (System .getProperty ("tests.rest.cluster" )).isPresent ()) {
99
- throw new RuntimeException ("cluster url should be provided for security enabled testing" );
100
- }
101
- }
102
-
103
- return isHttps ;
95
+ return Optional .ofNullable (System .getProperty ("https" )).map ("true" ::equalsIgnoreCase ).orElse (false );
104
96
}
105
97
106
98
@ Override
@@ -147,12 +139,12 @@ protected RestClient buildClient(Settings settings, HttpHost[] hosts) throws IOE
147
139
if (Objects .nonNull (keystore )) {
148
140
URI uri = null ;
149
141
try {
150
- uri = this .getClass ().getClassLoader ().getResource ("security/ sample.pem" ).toURI ();
142
+ uri = this .getClass ().getClassLoader ().getResource ("sample.pem" ).toURI ();
151
143
} catch (URISyntaxException e ) {
152
144
throw new RuntimeException (e );
153
145
}
154
146
Path configPath = PathUtils .get (uri ).getParent ().toAbsolutePath ();
155
- return new SecureRestClientBuilder (settings , configPath ).build ();
147
+ return new SecureRestClientBuilder (settings , configPath , hosts ).build ();
156
148
} else {
157
149
configureHttpsClient (builder , settings );
158
150
builder .setStrictDeprecationMode (strictDeprecationMode );
@@ -214,6 +206,7 @@ protected static void configureHttpsClient(RestClientBuilder builder, Settings s
214
206
.ofNullable (System .getProperty ("password" ))
215
207
.orElseThrow (() -> new RuntimeException ("password is missing" ));
216
208
BasicCredentialsProvider credentialsProvider = new BasicCredentialsProvider ();
209
+
217
210
final AuthScope anyScope = new AuthScope (null , -1 );
218
211
credentialsProvider .setCredentials (anyScope , new UsernamePasswordCredentials (userName , password .toCharArray ()));
219
212
try {
0 commit comments