87 lines
3.6 KiB
Groovy
87 lines
3.6 KiB
Groovy
import org.elasticsearch.gradle.info.BuildParams
|
|
import org.elasticsearch.gradle.test.RestIntegTestTask
|
|
|
|
apply plugin: 'elasticsearch.testclusters'
|
|
apply plugin: 'elasticsearch.standalone-test'
|
|
|
|
dependencies {
|
|
testImplementation project(path: xpackModule('core'), configuration: 'testArtifacts')
|
|
testImplementation project(xpackModule('ccr'))
|
|
testImplementation project(':x-pack:plugin:ccr:qa')
|
|
}
|
|
|
|
task "leader-cluster"(type: RestIntegTestTask) {
|
|
mustRunAfter(precommit)
|
|
runner {
|
|
systemProperty 'tests.target_cluster', 'leader'
|
|
}
|
|
}
|
|
testClusters."leader-cluster" {
|
|
testDistribution = 'DEFAULT'
|
|
setting 'xpack.license.self_generated.type', 'trial'
|
|
}
|
|
|
|
File policyFile = file("${buildDir}/tmp/java.policy")
|
|
tasks.register("writeJavaPolicy") {
|
|
doLast {
|
|
if (policyFile.parentFile.exists() == false && policyFile.parentFile.mkdirs() == false) {
|
|
throw new GradleException("failed to create temporary directory [${tmp}]")
|
|
}
|
|
if (BuildParams.inFipsJvm) {
|
|
policyFile.write(
|
|
[
|
|
"grant {",
|
|
"permission java.security.SecurityPermission \"putProviderProperty.BCFIPS\";",
|
|
"permission java.security.SecurityPermission \"putProviderProperty.BCJSSE\";",
|
|
"permission java.lang.RuntimePermission \"getProtectionDomain\";",
|
|
"permission java.util.PropertyPermission \"java.runtime.name\", \"read\";",
|
|
"permission org.bouncycastle.crypto.CryptoServicesPermission \"tlsAlgorithmsEnabled\";",
|
|
"permission java.lang.RuntimePermission \"accessClassInPackage.sun.security.internal.spec\";",
|
|
"permission java.lang.RuntimePermission \"accessDeclaredMembers\";",
|
|
"permission java.util.PropertyPermission \"intellij.debug.agent\", \"read\";",
|
|
"permission java.util.PropertyPermission \"intellij.debug.agent\", \"write\";",
|
|
"permission org.bouncycastle.crypto.CryptoServicesPermission \"exportSecretKey\";",
|
|
"permission org.bouncycastle.crypto.CryptoServicesPermission \"exportPrivateKey\";",
|
|
"permission java.io.FilePermission \"\${javax.net.ssl.trustStore}\", \"read\";",
|
|
"permission java.io.FilePermission \"${-> testClusters."follow-cluster".getFirstNode().getServerLog()}\", \"read\";",
|
|
"};"
|
|
].join("\n")
|
|
)
|
|
} else {
|
|
policyFile.write(
|
|
[
|
|
"grant {",
|
|
" permission java.io.FilePermission \"${-> testClusters."follow-cluster".getFirstNode().getServerLog()}\", \"read\";",
|
|
"};"
|
|
].join("\n")
|
|
)
|
|
}
|
|
}
|
|
}
|
|
|
|
task "follow-cluster"(type: RestIntegTestTask) {
|
|
dependsOn 'writeJavaPolicy', "leader-cluster"
|
|
runner {
|
|
useCluster testClusters."leader-cluster"
|
|
if (BuildParams.inFipsJvm){
|
|
systemProperty 'java.security.policy', "=file://${policyFile}"
|
|
} else {
|
|
systemProperty 'java.security.policy', "file://${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" {
|
|
testDistribution = '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(",")}\"" }
|
|
}
|
|
|
|
|
|
tasks.named("check").configure { dependsOn "follow-cluster" }
|
|
// no unit tests for multi-cluster-search, only the rest integration test
|
|
tasks.named("test").configure { enabled = false } |