2016-11-22 11:42:51 -05:00
|
|
|
import org.elasticsearch.gradle.test.ClusterConfiguration
|
|
|
|
import org.elasticsearch.gradle.test.ClusterFormationTasks
|
|
|
|
import org.elasticsearch.gradle.test.NodeInfo
|
|
|
|
|
2017-11-08 14:39:02 -05:00
|
|
|
apply plugin: 'elasticsearch.standalone-test'
|
2017-01-04 22:11:48 -05:00
|
|
|
apply plugin: 'elasticsearch.standalone-rest-test'
|
2016-11-22 11:42:51 -05:00
|
|
|
apply plugin: 'elasticsearch.rest-test'
|
|
|
|
|
|
|
|
dependencies {
|
2017-11-08 14:39:02 -05:00
|
|
|
testCompile project(path: ':modules:tribe', configuration: 'runtime')
|
2017-02-10 14:02:42 -05:00
|
|
|
testCompile project(path: ':x-pack-elasticsearch:plugin', configuration: 'runtime')
|
|
|
|
testCompile project(path: ':x-pack-elasticsearch:plugin', configuration: 'testArtifacts')
|
2016-11-22 11:42:51 -05:00
|
|
|
}
|
|
|
|
|
2017-11-08 14:39:02 -05:00
|
|
|
compileTestJava.options.compilerArgs << "-Xlint:-rawtypes,-unchecked"
|
|
|
|
namingConventions.skipIntegTestInDisguise = true
|
|
|
|
|
|
|
|
test {
|
|
|
|
/*
|
|
|
|
* We have to disable setting the number of available processors as tests in the same JVM randomize processors and will step on each
|
|
|
|
* other if we allow them to set the number of available processors as it's set-once in Netty.
|
|
|
|
*/
|
|
|
|
systemProperty 'es.set.netty.runtime.available.processors', 'false'
|
|
|
|
include '**/*Tests.class'
|
|
|
|
}
|
|
|
|
|
|
|
|
String licensePath = project(':x-pack-elasticsearch:license-tools').projectDir.toPath().resolve('src/test/resources').toString()
|
|
|
|
sourceSets {
|
|
|
|
test {
|
|
|
|
resources {
|
|
|
|
srcDirs += [licensePath]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
project.forbiddenPatterns {
|
|
|
|
exclude '**/*.key'
|
|
|
|
}
|
2016-11-22 11:42:51 -05:00
|
|
|
|
2017-03-31 17:30:44 -04:00
|
|
|
task setupClusterOne {}
|
2017-02-22 03:56:52 -05:00
|
|
|
ClusterConfiguration cluster1Config = new ClusterConfiguration(project)
|
|
|
|
cluster1Config.clusterName = 'cluster1'
|
|
|
|
cluster1Config.setting('node.name', 'cluster1-node1')
|
|
|
|
// x-pack
|
|
|
|
cluster1Config.plugin(':x-pack-elasticsearch:plugin')
|
|
|
|
cluster1Config.setting('xpack.monitoring.enabled', false)
|
|
|
|
cluster1Config.setting('xpack.security.enabled', false)
|
|
|
|
cluster1Config.setting('xpack.watcher.enabled', false)
|
|
|
|
cluster1Config.setting('xpack.graph.enabled', false)
|
2017-03-02 12:01:05 -05:00
|
|
|
cluster1Config.setting('xpack.ml.enabled', false)
|
2016-11-22 11:42:51 -05:00
|
|
|
|
2017-03-31 17:30:44 -04:00
|
|
|
List<NodeInfo> cluster1Nodes = ClusterFormationTasks.setup(project, 'clusterOne', setupClusterOne, cluster1Config)
|
2016-11-22 11:42:51 -05:00
|
|
|
|
2017-03-31 17:30:44 -04:00
|
|
|
task setupClusterTwo {}
|
2017-02-22 03:56:52 -05:00
|
|
|
ClusterConfiguration cluster2Config = new ClusterConfiguration(project)
|
|
|
|
cluster2Config.clusterName = 'cluster2'
|
|
|
|
cluster2Config.setting('node.name', 'cluster2-node1')
|
|
|
|
// x-pack
|
|
|
|
cluster2Config.plugin(':x-pack-elasticsearch:plugin')
|
|
|
|
cluster2Config.setting('xpack.monitoring.enabled', false)
|
|
|
|
cluster2Config.setting('xpack.monitoring.enabled', false)
|
|
|
|
cluster2Config.setting('xpack.security.enabled', false)
|
|
|
|
cluster2Config.setting('xpack.watcher.enabled', false)
|
|
|
|
cluster2Config.setting('xpack.graph.enabled', false)
|
2017-03-02 12:01:05 -05:00
|
|
|
cluster2Config.setting('xpack.ml.enabled', false)
|
2016-11-22 11:42:51 -05:00
|
|
|
|
2017-03-31 17:30:44 -04:00
|
|
|
List<NodeInfo> cluster2Nodes = ClusterFormationTasks.setup(project, 'clusterTwo', setupClusterTwo, cluster2Config)
|
2016-11-22 11:42:51 -05:00
|
|
|
|
2017-02-22 03:56:52 -05:00
|
|
|
integTestCluster {
|
2017-04-17 19:04:09 -04:00
|
|
|
dependsOn setupClusterOne, setupClusterTwo
|
2017-02-22 03:56:52 -05:00
|
|
|
setting 'node.name', 'tribe-node'
|
|
|
|
setting 'tribe.on_conflict', 'prefer_cluster1'
|
|
|
|
setting 'tribe.cluster1.cluster.name', 'cluster1'
|
|
|
|
setting 'tribe.cluster1.discovery.zen.ping.unicast.hosts', "'${-> cluster1Nodes.get(0).transportUri()}'"
|
|
|
|
setting 'tribe.cluster1.http.enabled', 'true'
|
|
|
|
setting 'tribe.cluster1.xpack.monitoring.enabled', false
|
|
|
|
setting 'tribe.cluster1.xpack.monitoring.enabled', false
|
|
|
|
setting 'tribe.cluster1.xpack.security.enabled', false
|
|
|
|
setting 'tribe.cluster1.xpack.watcher.enabled', false
|
|
|
|
setting 'tribe.cluster1.xpack.graph.enabled', false
|
2017-03-02 12:01:05 -05:00
|
|
|
setting 'tribe.cluster1.xpack.ml.enabled', false
|
2017-02-22 03:56:52 -05:00
|
|
|
setting 'tribe.cluster2.cluster.name', 'cluster2'
|
|
|
|
setting 'tribe.cluster2.discovery.zen.ping.unicast.hosts', "'${-> cluster2Nodes.get(0).transportUri()}'"
|
|
|
|
setting 'tribe.cluster2.http.enabled', 'true'
|
|
|
|
setting 'tribe.cluster2.xpack.monitoring.enabled', false
|
|
|
|
setting 'tribe.cluster2.xpack.monitoring.enabled', false
|
|
|
|
setting 'tribe.cluster2.xpack.security.enabled', false
|
|
|
|
setting 'tribe.cluster2.xpack.watcher.enabled', false
|
|
|
|
setting 'tribe.cluster2.xpack.graph.enabled', false
|
2017-03-02 12:01:05 -05:00
|
|
|
setting 'tribe.cluster2.xpack.ml.enabled', false
|
2017-02-22 03:56:52 -05:00
|
|
|
// x-pack
|
|
|
|
plugin ':x-pack-elasticsearch:plugin'
|
|
|
|
setting 'xpack.monitoring.enabled', false
|
|
|
|
setting 'xpack.monitoring.enabled', false
|
|
|
|
setting 'xpack.security.enabled', false
|
|
|
|
setting 'xpack.watcher.enabled', false
|
|
|
|
setting 'xpack.graph.enabled', false
|
2017-03-02 12:01:05 -05:00
|
|
|
setting 'xpack.ml.enabled', false
|
2017-04-27 03:57:54 -04:00
|
|
|
waitCondition = { node, ant ->
|
|
|
|
File tmpFile = new File(node.cwd, 'wait.success')
|
|
|
|
// 5 nodes: tribe + clusterOne (1 node + tribe internal node) + clusterTwo (1 node + tribe internal node)
|
|
|
|
ant.get(src: "http://${node.httpUri()}/_cluster/health?wait_for_nodes=>=5&wait_for_status=yellow",
|
|
|
|
dest: tmpFile.toString(),
|
|
|
|
ignoreerrors: true,
|
|
|
|
retries: 10)
|
|
|
|
return tmpFile.exists()
|
|
|
|
}
|
2016-11-22 11:42:51 -05:00
|
|
|
}
|
|
|
|
|
2017-02-22 03:56:52 -05:00
|
|
|
integTestRunner {
|
2017-11-08 14:39:02 -05:00
|
|
|
/*
|
|
|
|
* We have to disable setting the number of available processors as tests in the same JVM randomize processors and will step on each
|
|
|
|
* other if we allow them to set the number of available processors as it's set-once in Netty.
|
|
|
|
*/
|
|
|
|
systemProperty 'es.set.netty.runtime.available.processors', 'false'
|
2017-02-22 03:56:52 -05:00
|
|
|
systemProperty 'tests.cluster', "${-> cluster1Nodes.get(0).transportUri()}"
|
|
|
|
systemProperty 'tests.cluster2', "${-> cluster2Nodes.get(0).transportUri()}"
|
|
|
|
systemProperty 'tests.tribe', "${-> integTest.nodes.get(0).transportUri()}"
|
2017-03-31 17:30:44 -04:00
|
|
|
finalizedBy 'clusterOne#stop'
|
|
|
|
finalizedBy 'clusterTwo#stop'
|
2017-01-03 15:43:22 -05:00
|
|
|
}
|