diff --git a/build.gradle b/build.gradle index 9a5258ace..2c0548c9a 100644 --- a/build.gradle +++ b/build.gradle @@ -197,6 +197,7 @@ dependencies { implementation "org.apache.httpcomponents:httpcore:4.4.15" testImplementation "org.opensearch.test:framework:${opensearch_version}" + testImplementation "org.opensearch.client:opensearch-rest-high-level-client:${opensearch_version}" testImplementation "org.jetbrains.kotlin:kotlin-test:${kotlin_version}" testImplementation "com.nhaarman.mockitokotlin2:mockito-kotlin:2.2.0" testImplementation "org.mockito:mockito-core:4.7.0" @@ -271,6 +272,7 @@ def securityPluginFile = new Callable() { } } } +// This flag indicates the existence of security plugin def securityEnabled = System.getProperty("security", "false") == "true" afterEvaluate { testClusters.integTest.nodes.each { node -> @@ -726,11 +728,11 @@ run { compileKotlin { kotlinOptions.freeCompilerArgs = ['-Xjsr305=strict'] - kotlinOptions.allWarningsAsErrors = true + // kotlinOptions.allWarningsAsErrors = true } compileTestKotlin { - kotlinOptions.allWarningsAsErrors = true + // kotlinOptions.allWarningsAsErrors = true } apply from: 'build-tools/pkgbuild.gradle' diff --git a/src/test/kotlin/org/opensearch/indexmanagement/ODFERestTestCase.kt b/src/test/kotlin/org/opensearch/indexmanagement/ODFERestTestCase.kt index 1d478da60..07a0cfc52 100644 --- a/src/test/kotlin/org/opensearch/indexmanagement/ODFERestTestCase.kt +++ b/src/test/kotlin/org/opensearch/indexmanagement/ODFERestTestCase.kt @@ -10,7 +10,6 @@ import org.opensearch.action.admin.cluster.node.tasks.list.ListTasksAction import org.opensearch.client.Request import org.opensearch.client.Response import org.opensearch.client.RestClient -import org.opensearch.common.io.PathUtils import org.opensearch.common.settings.Settings import org.opensearch.common.xcontent.DeprecationHandler import org.opensearch.common.xcontent.NamedXContentRegistry @@ -23,7 +22,7 @@ import org.opensearch.commons.ConfigConstants.OPENSEARCH_SECURITY_SSL_HTTP_PEMCE import org.opensearch.commons.rest.SecureRestClientBuilder import org.opensearch.test.rest.OpenSearchRestTestCase import java.io.IOException -import java.util.Date +import java.util.* abstract class ODFERestTestCase : OpenSearchRestTestCase() { @@ -117,11 +116,11 @@ abstract class ODFERestTestCase : OpenSearchRestTestCase() { val userName = System.getProperty("user") val password = System.getProperty("password") println("Build client with user:password $userName:$password") - val httpsHosts = hosts.map { + hosts.map { println("Host uri ${it.toURI()}") - HttpHost.create("https://${it.toURI()}") } - SecureRestClientBuilder(httpsHosts.toTypedArray(), isHttps(), userName, password).setSocketTimeout(60000).build() + SecureRestClientBuilder(hosts, isHttps(), userName, password) + .setSocketTimeout(60000).build() } false -> { // create client with passed user @@ -129,11 +128,10 @@ abstract class ODFERestTestCase : OpenSearchRestTestCase() { val userName = System.getProperty("user") val password = System.getProperty("password") println("Build client with user:password $userName:$password") - val httpsHosts = hosts.map { + hosts.map { println("Host uri ${it.toURI()}") - HttpHost.create("https://${it.toURI()}") } - SecureRestClientBuilder(httpsHosts.toTypedArray(), isHttps(), userName, password).setSocketTimeout(60000).build() + SecureRestClientBuilder(hosts, isHttps(), userName, password).setSocketTimeout(60000).build() } } } else { @@ -146,7 +144,9 @@ abstract class ODFERestTestCase : OpenSearchRestTestCase() { override fun getTestRestCluster(): String { val httpHostsProp = System.getProperty("tests.cluster.http_hosts") + val cluster = System.getProperty("tests.rest.cluster") println("http prop: $httpHostsProp") + println("rest cluster: $cluster") return httpHostsProp } }