mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-03-09 14:34:43 +00:00
This commit adds separate tasks for tribe clusteres which the cluster formation tasks build their own tasks off. This ensures each cluster will have its own wait task, so that the tribe node will be able to wait on the other clusters being up before even trying to start. relates elastic/x-pack-elasticsearch#877 Original commit: elastic/x-pack-elasticsearch@1e4c729372
91 lines
4.0 KiB
Groovy
91 lines
4.0 KiB
Groovy
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')
|
|
}
|
|
|
|
task setupClusterOne {}
|
|
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')
|
|
configOne.setupCommand('setupDummyUser',
|
|
'bin/x-pack/users', 'useradd', 'test_user', '-p', 'changeme', '-r', 'superuser')
|
|
configOne.waitCondition = { node, ant ->
|
|
File tmpFile = new File(node.cwd, 'wait.success')
|
|
ant.get(src: "http://${node.httpUri()}/_cluster/health?wait_for_nodes=>=1&wait_for_status=yellow",
|
|
dest: tmpFile.toString(),
|
|
username: 'test_user',
|
|
password: 'changeme',
|
|
ignoreerrors: true,
|
|
retries: 10)
|
|
return tmpFile.exists()
|
|
}
|
|
List<NodeInfo> cluster1Nodes = ClusterFormationTasks.setup(project, 'clusterOne', setupClusterOne, configOne)
|
|
|
|
task setupClusterTwo {}
|
|
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')
|
|
configTwo.setupCommand('setupDummyUser',
|
|
'bin/x-pack/users', 'useradd', 'test_user', '-p', 'changeme', '-r', 'superuser')
|
|
configTwo.waitCondition = { node, ant ->
|
|
File tmpFile = new File(node.cwd, 'wait.success')
|
|
ant.get(src: "http://${node.httpUri()}/_cluster/health?wait_for_nodes=>=1&wait_for_status=yellow",
|
|
dest: tmpFile.toString(),
|
|
username: 'test_user',
|
|
password: 'changeme',
|
|
ignoreerrors: true,
|
|
retries: 10)
|
|
return tmpFile.exists()
|
|
}
|
|
List<NodeInfo> cluster2Nodes = ClusterFormationTasks.setup(project, 'clusterTwo', setupClusterTwo, configTwo)
|
|
|
|
integTestCluster {
|
|
plugin ':x-pack-elasticsearch:plugin'
|
|
setupCommand 'setupDummyUser',
|
|
'bin/x-pack/users', 'useradd', 'test_user', '-p', 'changeme', '-r', 'superuser'
|
|
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'
|
|
setting 'tribe.cluster1.xpack.ml.enabled', 'false'
|
|
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.ml.enabled', 'false'
|
|
waitCondition = { node, ant ->
|
|
File tmpFile = new File(node.cwd, 'wait.success')
|
|
ant.get(src: "http://${node.httpUri()}/_cluster/health?wait_for_nodes=>=1&wait_for_status=yellow",
|
|
dest: tmpFile.toString(),
|
|
username: 'test_user',
|
|
password: 'changeme',
|
|
ignoreerrors: true,
|
|
retries: 10)
|
|
return tmpFile.exists()
|
|
}
|
|
}
|
|
|
|
integTestRunner {
|
|
dependsOn(setupClusterOne, setupClusterTwo)
|
|
systemProperty 'tests.cluster', "${-> cluster1Nodes.get(0).transportUri()}"
|
|
systemProperty 'tests.cluster2', "${-> cluster2Nodes.get(0).transportUri()}"
|
|
systemProperty 'tests.tribe', "${-> integTest.nodes.get(0).transportUri()}"
|
|
finalizedBy 'clusterOne#stop'
|
|
finalizedBy 'clusterTwo#stop'
|
|
}
|