Use GString and closures to delay evaluating remote cluster URL until runtime
This commit is contained in:
parent
276adbd990
commit
89a2384988
|
@ -96,15 +96,6 @@ class ClusterConfiguration {
|
|||
return seedNode.transportUri()
|
||||
}
|
||||
|
||||
/**
|
||||
* A closure to call which returns a map of settings.
|
||||
*
|
||||
* This can be used to pass settings to a cluster that are not available at evaluation time ie.
|
||||
* the address of a remote cluster etc.
|
||||
*/
|
||||
@Input
|
||||
Closure dynamicSettings = { -> Collections.emptyMap() }
|
||||
|
||||
/**
|
||||
* A closure to call before the cluster is considered ready. The closure is passed the node info,
|
||||
* as well as a groovy AntBuilder, to enable running ant condition checks. The default wait
|
||||
|
|
|
@ -294,8 +294,6 @@ class ClusterFormationTasks {
|
|||
if (unicastTransportUri != null) {
|
||||
esConfig['discovery.zen.ping.unicast.hosts'] = "\"${unicastTransportUri}\""
|
||||
}
|
||||
Map dynamicSettings = node.config.dynamicSettings();
|
||||
esConfig.putAll(dynamicSettings)
|
||||
File configFile = new File(node.confDir, 'elasticsearch.yml')
|
||||
logger.info("Configuring ${configFile}")
|
||||
configFile.setText(esConfig.collect { key, value -> "${key}: ${value}" }.join('\n'), 'UTF-8')
|
||||
|
|
|
@ -35,10 +35,8 @@ task mixedClusterTest(type: RestIntegTestTask) {
|
|||
dependsOn(remoteClusterTest)
|
||||
cluster {
|
||||
distribution = 'zip'
|
||||
dynamicSettings = { ->
|
||||
Collections.singletonMap("action.search.remote.my_remote_cluster",
|
||||
"\"${remoteClusterTest.nodes.get(0).transportUri()}\"")
|
||||
}
|
||||
setting 'action.search.remote.my_remote_cluster', "\"${-> remoteClusterTest.nodes.get(0).transportUri()}\""
|
||||
|
||||
}
|
||||
systemProperty 'tests.rest.suite', 'multi_cluster'
|
||||
finalizedBy 'remoteClusterTest#stop'
|
||||
|
|
Loading…
Reference in New Issue