2017-02-28 18:36:53 -05:00
|
|
|
import org.elasticsearch.gradle.test.ClusterConfiguration
|
|
|
|
import org.elasticsearch.gradle.test.ClusterFormationTasks
|
|
|
|
import org.elasticsearch.gradle.test.NodeInfo
|
|
|
|
|
|
|
|
apply plugin: 'elasticsearch.standalone-rest-test'
|
|
|
|
apply plugin: 'elasticsearch.rest-test'
|
|
|
|
|
|
|
|
dependencies {
|
|
|
|
testCompile project(path: ':x-pack-elasticsearch:plugin', configuration: 'runtime')
|
|
|
|
testCompile project(path: ':x-pack-elasticsearch:plugin', configuration: 'testArtifacts')
|
2017-06-15 17:25:32 -04:00
|
|
|
testCompile project(path: ':modules:analysis-common', configuration: 'runtime')
|
2017-02-28 18:36:53 -05:00
|
|
|
}
|
|
|
|
|
2017-03-31 17:30:44 -04:00
|
|
|
task setupClusterOne {}
|
2017-02-28 18:36:53 -05:00
|
|
|
ClusterConfiguration configOne = new ClusterConfiguration(project)
|
|
|
|
configOne.clusterName = 'cluster1'
|
|
|
|
configOne.setting('node.name', 'cluster1-node1')
|
|
|
|
configOne.setting('xpack.monitoring.enabled', false)
|
|
|
|
configOne.setting('xpack.ml.enabled', false)
|
|
|
|
configOne.plugin(':x-pack-elasticsearch:plugin')
|
2017-06-15 17:25:32 -04:00
|
|
|
configOne.module(project.project(':modules:analysis-common'))
|
2017-02-28 18:36:53 -05:00
|
|
|
configOne.setupCommand('setupDummyUser',
|
2017-06-29 16:27:57 -04:00
|
|
|
'bin/x-pack/users', 'useradd', 'test_user', '-p', 'x-pack-test-password', '-r', 'superuser')
|
2017-02-28 18:36:53 -05:00
|
|
|
configOne.waitCondition = { node, ant ->
|
|
|
|
File tmpFile = new File(node.cwd, 'wait.success')
|
2017-03-15 18:55:10 -04:00
|
|
|
ant.get(src: "http://${node.httpUri()}/_cluster/health?wait_for_nodes=>=1&wait_for_status=yellow",
|
2017-02-28 18:36:53 -05:00
|
|
|
dest: tmpFile.toString(),
|
|
|
|
username: 'test_user',
|
2017-06-29 16:27:57 -04:00
|
|
|
password: 'x-pack-test-password',
|
2017-02-28 18:36:53 -05:00
|
|
|
ignoreerrors: true,
|
|
|
|
retries: 10)
|
|
|
|
return tmpFile.exists()
|
|
|
|
}
|
2017-03-31 17:30:44 -04:00
|
|
|
List<NodeInfo> cluster1Nodes = ClusterFormationTasks.setup(project, 'clusterOne', setupClusterOne, configOne)
|
2017-02-28 18:36:53 -05:00
|
|
|
|
2017-03-31 17:30:44 -04:00
|
|
|
task setupClusterTwo {}
|
2017-02-28 18:36:53 -05:00
|
|
|
ClusterConfiguration configTwo = new ClusterConfiguration(project)
|
|
|
|
configTwo.clusterName = 'cluster2'
|
|
|
|
configTwo.setting('node.name', 'cluster2-node1')
|
|
|
|
configTwo.setting('xpack.monitoring.enabled', false)
|
|
|
|
configTwo.setting('xpack.ml.enabled', false)
|
|
|
|
configTwo.plugin(':x-pack-elasticsearch:plugin')
|
2017-06-15 17:25:32 -04:00
|
|
|
configTwo.module(project.project(':modules:analysis-common'))
|
2017-02-28 18:36:53 -05:00
|
|
|
configTwo.setupCommand('setupDummyUser',
|
2017-06-29 16:27:57 -04:00
|
|
|
'bin/x-pack/users', 'useradd', 'test_user', '-p', 'x-pack-test-password', '-r', 'superuser')
|
2017-02-28 18:36:53 -05:00
|
|
|
configTwo.waitCondition = { node, ant ->
|
|
|
|
File tmpFile = new File(node.cwd, 'wait.success')
|
2017-03-15 18:55:10 -04:00
|
|
|
ant.get(src: "http://${node.httpUri()}/_cluster/health?wait_for_nodes=>=1&wait_for_status=yellow",
|
2017-02-28 18:36:53 -05:00
|
|
|
dest: tmpFile.toString(),
|
|
|
|
username: 'test_user',
|
2017-06-29 16:27:57 -04:00
|
|
|
password: 'x-pack-test-password',
|
2017-02-28 18:36:53 -05:00
|
|
|
ignoreerrors: true,
|
|
|
|
retries: 10)
|
|
|
|
return tmpFile.exists()
|
|
|
|
}
|
2017-03-31 17:30:44 -04:00
|
|
|
List<NodeInfo> cluster2Nodes = ClusterFormationTasks.setup(project, 'clusterTwo', setupClusterTwo, configTwo)
|
2017-02-28 18:36:53 -05:00
|
|
|
|
|
|
|
integTestCluster {
|
2017-04-17 19:04:09 -04:00
|
|
|
dependsOn setupClusterOne, setupClusterTwo
|
2017-02-28 18:36:53 -05:00
|
|
|
plugin ':x-pack-elasticsearch:plugin'
|
|
|
|
setupCommand 'setupDummyUser',
|
2017-06-29 16:27:57 -04:00
|
|
|
'bin/x-pack/users', 'useradd', 'test_user', '-p', 'x-pack-test-password', '-r', 'superuser'
|
2017-02-28 18:36:53 -05:00
|
|
|
setting 'xpack.monitoring.enabled', false
|
|
|
|
setting 'xpack.ml.enabled', false
|
|
|
|
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'
|
2017-03-02 12:01:05 -05:00
|
|
|
setting 'tribe.cluster1.xpack.ml.enabled', 'false'
|
2017-02-28 18:36:53 -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'
|
2017-03-02 12:01:05 -05:00
|
|
|
setting 'tribe.cluster2.xpack.ml.enabled', 'false'
|
2017-02-28 18:36:53 -05:00
|
|
|
waitCondition = { node, ant ->
|
|
|
|
File tmpFile = new File(node.cwd, 'wait.success')
|
2017-04-27 03:57:54 -04:00
|
|
|
// 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",
|
2017-02-28 18:36:53 -05:00
|
|
|
dest: tmpFile.toString(),
|
|
|
|
username: 'test_user',
|
2017-06-29 16:27:57 -04:00
|
|
|
password: 'x-pack-test-password',
|
2017-02-28 18:36:53 -05:00
|
|
|
ignoreerrors: true,
|
|
|
|
retries: 10)
|
|
|
|
return tmpFile.exists()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
integTestRunner {
|
|
|
|
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-02-28 18:36:53 -05:00
|
|
|
}
|