2018-11-09 11:43:43 -05:00
|
|
|
import org.elasticsearch.gradle.test.RestIntegTestTask
|
|
|
|
|
|
|
|
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 leaderClusterTest(type: RestIntegTestTask) {
|
|
|
|
mustRunAfter(precommit)
|
|
|
|
}
|
|
|
|
|
|
|
|
leaderClusterTestCluster {
|
|
|
|
numNodes = 1
|
|
|
|
clusterName = 'leader-cluster'
|
|
|
|
setting 'xpack.license.self_generated.type', 'trial'
|
|
|
|
}
|
|
|
|
|
|
|
|
leaderClusterTestRunner {
|
|
|
|
systemProperty 'tests.target_cluster', 'leader'
|
|
|
|
}
|
|
|
|
|
|
|
|
task writeJavaPolicy {
|
|
|
|
doLast {
|
|
|
|
final File tmp = file("${buildDir}/tmp")
|
|
|
|
if (tmp.exists() == false && tmp.mkdirs() == false) {
|
|
|
|
throw new GradleException("failed to create temporary directory [${tmp}]")
|
|
|
|
}
|
|
|
|
final File javaPolicy = file("${tmp}/java.policy")
|
|
|
|
javaPolicy.write(
|
|
|
|
[
|
|
|
|
"grant {",
|
Elasticsearch support to JSON logging (#36833)
In order to support JSON log format, a custom pattern layout was used and its configuration is enclosed in ESJsonLayout. Users are free to use their own patterns, but if smooth Beats integration is needed, they should use ESJsonLayout. EvilLoggerTests are left intact to make sure user's custom log patterns work fine.
To populate additional fields node.id and cluster.uuid which are not available at start time,
a cluster state update will have to be received and the values passed to log4j pattern converter.
A ClusterStateObserver.Listener is used to receive only one ClusteStateUpdate. Once update is received the nodeId and clusterUUid are set in a static field in a NodeAndClusterIdConverter.
Following fields are expected in JSON log lines: type, tiemstamp, level, component, cluster.name, node.name, node.id, cluster.uuid, message, stacktrace
see ESJsonLayout.java for more details and field descriptions
Docker log4j2 configuration is now almost the same as the one use for ES binary.
The only difference is that docker is using console appenders, whereas ES is using file appenders.
relates: #32850
2019-01-29 01:20:09 -05:00
|
|
|
" permission java.io.FilePermission \"${-> followClusterTest.getNodes().get(0).homeDir}/logs/${-> followClusterTest.getNodes().get(0).clusterName}_server.json\", \"read\";",
|
2018-11-09 11:43:43 -05:00
|
|
|
"};"
|
|
|
|
].join("\n"))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
task followClusterTest(type: RestIntegTestTask) {}
|
|
|
|
followClusterTest.dependsOn writeJavaPolicy
|
|
|
|
|
|
|
|
followClusterTestCluster {
|
|
|
|
dependsOn leaderClusterTestRunner
|
|
|
|
numNodes = 1
|
|
|
|
clusterName = 'follow-cluster'
|
|
|
|
setting 'xpack.monitoring.collection.enabled', 'true'
|
|
|
|
setting 'xpack.license.self_generated.type', 'trial'
|
|
|
|
setting 'cluster.remote.leader_cluster.seeds', "\"${-> leaderClusterTest.nodes.get(0).transportUri()}\""
|
|
|
|
}
|
|
|
|
|
|
|
|
followClusterTestRunner {
|
|
|
|
systemProperty 'java.security.policy', "file://${buildDir}/tmp/java.policy"
|
|
|
|
systemProperty 'tests.target_cluster', 'follow'
|
2019-04-09 14:52:50 -04:00
|
|
|
nonInputProperties.systemProperty 'tests.leader_host', "${-> leaderClusterTest.nodes.get(0).httpUri()}"
|
|
|
|
nonInputProperties.systemProperty 'log', "${-> followClusterTest.getNodes().get(0).homeDir}/logs/" +
|
Elasticsearch support to JSON logging (#36833)
In order to support JSON log format, a custom pattern layout was used and its configuration is enclosed in ESJsonLayout. Users are free to use their own patterns, but if smooth Beats integration is needed, they should use ESJsonLayout. EvilLoggerTests are left intact to make sure user's custom log patterns work fine.
To populate additional fields node.id and cluster.uuid which are not available at start time,
a cluster state update will have to be received and the values passed to log4j pattern converter.
A ClusterStateObserver.Listener is used to receive only one ClusteStateUpdate. Once update is received the nodeId and clusterUUid are set in a static field in a NodeAndClusterIdConverter.
Following fields are expected in JSON log lines: type, tiemstamp, level, component, cluster.name, node.name, node.id, cluster.uuid, message, stacktrace
see ESJsonLayout.java for more details and field descriptions
Docker log4j2 configuration is now almost the same as the one use for ES binary.
The only difference is that docker is using console appenders, whereas ES is using file appenders.
relates: #32850
2019-01-29 01:20:09 -05:00
|
|
|
"${-> followClusterTest.getNodes().get(0).clusterName}_server.json"
|
2018-11-09 11:43:43 -05:00
|
|
|
finalizedBy 'leaderClusterTestCluster#stop'
|
|
|
|
}
|
|
|
|
|
|
|
|
check.dependsOn followClusterTest
|
2019-04-09 14:52:50 -04:00
|
|
|
test.enabled = false // no unit tests for multi-cluster-search, only the rest integration test
|