Skip to content

Commit 787a192

Browse files
committed
add gradle task to run integtest against remote cluster
Signed-off-by: Zhongnan Su <[email protected]>
1 parent 37fe669 commit 787a192

File tree

1 file changed

+25
-4
lines changed

1 file changed

+25
-4
lines changed

reports-scheduler/build.gradle

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -163,8 +163,8 @@ test {
163163
File repo = file("$buildDir/testclusters/repo")
164164
def _numNodes = findProperty('numNodes') as Integer ?: 1
165165

166-
def es_tmp_dir = rootProject.file('build/private/es_tmp').absoluteFile
167-
es_tmp_dir.mkdirs()
166+
def opensearch_tmp_dir = rootProject.file('build/private/es_tmp').absoluteFile
167+
opensearch_tmp_dir.mkdirs()
168168

169169
// As of ES 7.7 the sample-extension-plugin is being added to the list of plugins for the testCluster during build before
170170
// the job-scheduler plugin is causing build failures.
@@ -185,15 +185,16 @@ tasks.withType(licenseHeaders.class) {
185185
}
186186

187187
task integTest(type: RestIntegTestTask) {
188-
description = "Run tests against a cluster that has security enabled"
188+
description = "Run tests against a cluster"
189189
testClassesDirs = sourceSets.test.output.classesDirs
190190
classpath = sourceSets.test.runtimeClasspath
191191
}
192192
tasks.named("check").configure { dependsOn(integTest) }
193193

194194
integTest {
195+
dependsOn "bundlePlugin"
195196
systemProperty 'tests.security.manager', 'false'
196-
systemProperty 'java.io.tmpdir', es_tmp_dir.absolutePath
197+
systemProperty 'java.io.tmpdir', opensearch_tmp_dir.absolutePath
197198

198199
systemProperty "https", System.getProperty("https")
199200
systemProperty "user", System.getProperty("user")
@@ -224,6 +225,8 @@ integTest {
224225
}
225226
}
226227

228+
229+
227230
Zip bundle = (Zip) project.getTasks().getByName("bundlePlugin");
228231
integTest.dependsOn(bundle)
229232
integTest.getClusters().forEach{c -> c.plugin(project.getObjects().fileProperty().value(bundle.getArchiveFile()))}
@@ -257,6 +260,24 @@ testClusters.integTest {
257260
setting 'path.repo', repo.absolutePath
258261
}
259262

263+
task integTestRemote(type: RestIntegTestTask) {
264+
testClassesDirs = sourceSets.test.output.classesDirs
265+
classpath = sourceSets.test.runtimeClasspath
266+
systemProperty 'tests.security.manager', 'false'
267+
systemProperty 'java.io.tmpdir', opensearch_tmp_dir.absolutePath
268+
269+
systemProperty "https", System.getProperty("https")
270+
systemProperty "user", System.getProperty("user")
271+
systemProperty "password", System.getProperty("password")
272+
273+
// Only rest case can run with remote cluster
274+
if (System.getProperty("tests.rest.cluster") != null) {
275+
filter {
276+
includeTestsMatching "org.opensearch.reportsscheduler.rest.*IT"
277+
}
278+
}
279+
}
280+
260281
run {
261282
doFirst {
262283
// There seems to be an issue when running multi node run or integ tasks with unicast_hosts

0 commit comments

Comments
 (0)