Skip to content

Commit 62d3cf4

Browse files
committed
Fix tests
Signed-off-by: Craig Perkins <cwperx@amazon.com>
1 parent 513cdd2 commit 62d3cf4

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

src/test/java/org/opensearch/timeseries/ODFERestTestCase.java

+4-11
Original file line numberDiff line numberDiff line change
@@ -92,15 +92,7 @@ public abstract class ODFERestTestCase extends OpenSearchRestTestCase {
9292
private static final Logger LOG = (Logger) LogManager.getLogger(ODFERestTestCase.class);
9393

9494
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);
10496
}
10597

10698
@Override
@@ -147,12 +139,12 @@ protected RestClient buildClient(Settings settings, HttpHost[] hosts) throws IOE
147139
if (Objects.nonNull(keystore)) {
148140
URI uri = null;
149141
try {
150-
uri = this.getClass().getClassLoader().getResource("security/sample.pem").toURI();
142+
uri = this.getClass().getClassLoader().getResource("sample.pem").toURI();
151143
} catch (URISyntaxException e) {
152144
throw new RuntimeException(e);
153145
}
154146
Path configPath = PathUtils.get(uri).getParent().toAbsolutePath();
155-
return new SecureRestClientBuilder(settings, configPath).build();
147+
return new SecureRestClientBuilder(settings, configPath, hosts).build();
156148
} else {
157149
configureHttpsClient(builder, settings);
158150
builder.setStrictDeprecationMode(strictDeprecationMode);
@@ -214,6 +206,7 @@ protected static void configureHttpsClient(RestClientBuilder builder, Settings s
214206
.ofNullable(System.getProperty("password"))
215207
.orElseThrow(() -> new RuntimeException("password is missing"));
216208
BasicCredentialsProvider credentialsProvider = new BasicCredentialsProvider();
209+
217210
final AuthScope anyScope = new AuthScope(null, -1);
218211
credentialsProvider.setCredentials(anyScope, new UsernamePasswordCredentials(userName, password.toCharArray()));
219212
try {

0 commit comments

Comments
 (0)