OpenSearch/x-pack/plugin/ccr/qa/downgrade-to-basic-license/build.gradle

60 lines
2.2 KiB
Groovy

import org.elasticsearch.gradle.test.RestIntegTestTask
apply plugin: 'elasticsearch.testclusters'
apply plugin: 'elasticsearch.standalone-test'
dependencies {
testCompile project(path: xpackModule('core'), configuration: 'testArtifacts')
testCompile project(path: xpackModule('ccr'), configuration: 'runtime')
testCompile project(':x-pack:plugin:ccr:qa')
}
task "leader-cluster"(type: RestIntegTestTask) {
mustRunAfter(precommit)
runner {
systemProperty 'tests.target_cluster', 'leader'
}
}
testClusters."leader-cluster" {
distribution = "DEFAULT"
setting 'xpack.license.self_generated.type', 'trial'
}
task writeJavaPolicy {
ext.policyFile = file("${buildDir}/tmp/java.policy")
doLast {
if (policyFile.parentFile.exists() == false && policyFile.parentFile.mkdirs() == false) {
throw new GradleException("failed to create temporary directory [${tmp}]")
}
policyFile.write(
[
"grant {",
" permission java.io.FilePermission \"${-> testClusters."follow-cluster".getFirstNode().getServerLog()}\", \"read\";",
"};"
].join("\n")
)
}
}
task "follow-cluster"(type: RestIntegTestTask) {
dependsOn writeJavaPolicy, "leader-cluster"
useCluster testClusters."leader-cluster"
runner {
systemProperty 'java.security.policy', "file://${writeJavaPolicy.policyFile}"
systemProperty 'tests.target_cluster', 'follow'
nonInputProperties.systemProperty 'tests.leader_host', "${-> testClusters."leader-cluster".getAllHttpSocketURI().get(0)}"
nonInputProperties.systemProperty 'log', "${-> testClusters."follow-cluster".getFirstNode().getServerLog()}"
}
}
testClusters."follow-cluster" {
distribution = "DEFAULT"
setting 'xpack.monitoring.collection.enabled', 'true'
setting 'xpack.license.self_generated.type', 'trial'
setting 'cluster.remote.leader_cluster.seeds', { "\"${testClusters."leader-cluster".getAllTransportPortURI().join(",")}\"" }
}
check.dependsOn "follow-cluster"
test.enabled = false // no unit tests for multi-cluster-search, only the rest integration test