From 787a19230d8d7cf462f153ddbbb63b3a386baf8c Mon Sep 17 00:00:00 2001 From: Zhongnan Su Date: Tue, 7 Dec 2021 14:37:46 -0800 Subject: [PATCH] add gradle task to run integtest against remote cluster Signed-off-by: Zhongnan Su --- reports-scheduler/build.gradle | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/reports-scheduler/build.gradle b/reports-scheduler/build.gradle index 395af841..b36e5054 100644 --- a/reports-scheduler/build.gradle +++ b/reports-scheduler/build.gradle @@ -163,8 +163,8 @@ test { File repo = file("$buildDir/testclusters/repo") def _numNodes = findProperty('numNodes') as Integer ?: 1 -def es_tmp_dir = rootProject.file('build/private/es_tmp').absoluteFile -es_tmp_dir.mkdirs() +def opensearch_tmp_dir = rootProject.file('build/private/es_tmp').absoluteFile +opensearch_tmp_dir.mkdirs() // As of ES 7.7 the sample-extension-plugin is being added to the list of plugins for the testCluster during build before // the job-scheduler plugin is causing build failures. @@ -185,15 +185,16 @@ tasks.withType(licenseHeaders.class) { } task integTest(type: RestIntegTestTask) { - description = "Run tests against a cluster that has security enabled" + description = "Run tests against a cluster" testClassesDirs = sourceSets.test.output.classesDirs classpath = sourceSets.test.runtimeClasspath } tasks.named("check").configure { dependsOn(integTest) } integTest { + dependsOn "bundlePlugin" systemProperty 'tests.security.manager', 'false' - systemProperty 'java.io.tmpdir', es_tmp_dir.absolutePath + systemProperty 'java.io.tmpdir', opensearch_tmp_dir.absolutePath systemProperty "https", System.getProperty("https") systemProperty "user", System.getProperty("user") @@ -224,6 +225,8 @@ integTest { } } + + Zip bundle = (Zip) project.getTasks().getByName("bundlePlugin"); integTest.dependsOn(bundle) integTest.getClusters().forEach{c -> c.plugin(project.getObjects().fileProperty().value(bundle.getArchiveFile()))} @@ -257,6 +260,24 @@ testClusters.integTest { setting 'path.repo', repo.absolutePath } +task integTestRemote(type: RestIntegTestTask) { + testClassesDirs = sourceSets.test.output.classesDirs + classpath = sourceSets.test.runtimeClasspath + systemProperty 'tests.security.manager', 'false' + systemProperty 'java.io.tmpdir', opensearch_tmp_dir.absolutePath + + systemProperty "https", System.getProperty("https") + systemProperty "user", System.getProperty("user") + systemProperty "password", System.getProperty("password") + + // Only rest case can run with remote cluster + if (System.getProperty("tests.rest.cluster") != null) { + filter { + includeTestsMatching "org.opensearch.reportsscheduler.rest.*IT" + } + } +} + run { doFirst { // There seems to be an issue when running multi node run or integ tasks with unicast_hosts