2020-05-21 12:26:56 -04:00
|
|
|
import org.elasticsearch.gradle.info.BuildParams
|
2018-11-09 11:43:43 -05:00
|
|
|
import org.elasticsearch.gradle.test.RestIntegTestTask
|
|
|
|
|
2019-05-29 09:16:04 -04:00
|
|
|
apply plugin: 'elasticsearch.testclusters'
|
2018-11-09 11:43:43 -05:00
|
|
|
apply plugin: 'elasticsearch.standalone-test'
|
|
|
|
|
|
|
|
dependencies {
|
2019-11-14 06:01:23 -05:00
|
|
|
testCompile project(path: xpackModule('core'), configuration: 'testArtifacts')
|
|
|
|
testCompile project(path: xpackModule('ccr'), configuration: 'runtime')
|
|
|
|
testCompile project(':x-pack:plugin:ccr:qa')
|
2018-11-09 11:43:43 -05:00
|
|
|
}
|
|
|
|
|
2019-05-29 09:16:04 -04:00
|
|
|
task "leader-cluster"(type: RestIntegTestTask) {
|
2019-11-14 06:01:23 -05:00
|
|
|
mustRunAfter(precommit)
|
|
|
|
runner {
|
|
|
|
systemProperty 'tests.target_cluster', 'leader'
|
|
|
|
}
|
2018-11-09 11:43:43 -05:00
|
|
|
}
|
2019-05-29 09:16:04 -04:00
|
|
|
testClusters."leader-cluster" {
|
2019-11-14 06:01:23 -05:00
|
|
|
testDistribution = 'DEFAULT'
|
|
|
|
setting 'xpack.license.self_generated.type', 'trial'
|
2018-11-09 11:43:43 -05:00
|
|
|
}
|
|
|
|
|
2019-06-20 02:21:29 -04:00
|
|
|
File policyFile = file("${buildDir}/tmp/java.policy")
|
2018-11-09 11:43:43 -05:00
|
|
|
task writeJavaPolicy {
|
2019-11-14 06:01:23 -05:00
|
|
|
doLast {
|
|
|
|
if (policyFile.parentFile.exists() == false && policyFile.parentFile.mkdirs() == false) {
|
|
|
|
throw new GradleException("failed to create temporary directory [${tmp}]")
|
2018-11-09 11:43:43 -05:00
|
|
|
}
|
2020-05-21 12:26:56 -04:00
|
|
|
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")
|
|
|
|
)
|
|
|
|
}
|
2019-11-14 06:01:23 -05:00
|
|
|
}
|
2018-11-09 11:43:43 -05:00
|
|
|
}
|
|
|
|
|
2019-05-29 09:16:04 -04:00
|
|
|
task "follow-cluster"(type: RestIntegTestTask) {
|
2019-11-14 06:01:23 -05:00
|
|
|
dependsOn 'writeJavaPolicy', "leader-cluster"
|
|
|
|
runner {
|
|
|
|
useCluster testClusters."leader-cluster"
|
2020-05-21 12:26:56 -04:00
|
|
|
if (BuildParams.inFipsJvm){
|
|
|
|
systemProperty 'java.security.policy', "=file://${policyFile}"
|
|
|
|
} else {
|
|
|
|
systemProperty 'java.security.policy', "file://${policyFile}"
|
|
|
|
}
|
2019-11-14 06:01:23 -05:00
|
|
|
systemProperty 'tests.target_cluster', 'follow'
|
|
|
|
nonInputProperties.systemProperty 'tests.leader_host', "${-> testClusters."leader-cluster".getAllHttpSocketURI().get(0)}"
|
|
|
|
nonInputProperties.systemProperty 'log', "${-> testClusters."follow-cluster".getFirstNode().getServerLog()}"
|
|
|
|
}
|
2019-05-29 09:16:04 -04:00
|
|
|
}
|
2018-11-09 11:43:43 -05:00
|
|
|
|
2019-05-29 09:16:04 -04:00
|
|
|
testClusters."follow-cluster" {
|
2019-11-14 06:01:23 -05:00
|
|
|
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(",")}\"" }
|
2018-11-09 11:43:43 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-05-29 09:16:04 -04:00
|
|
|
check.dependsOn "follow-cluster"
|
2019-04-09 14:52:50 -04:00
|
|
|
test.enabled = false // no unit tests for multi-cluster-search, only the rest integration test
|