2018-10-03 05:37:36 -04:00
|
|
|
/*
|
|
|
|
* Licensed to Elasticsearch under one or more contributor
|
|
|
|
* license agreements. See the NOTICE file distributed with
|
|
|
|
* this work for additional information regarding copyright
|
|
|
|
* ownership. Elasticsearch licenses this file to you under
|
|
|
|
* the Apache License, Version 2.0 (the "License"); you may
|
|
|
|
* not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing,
|
|
|
|
* software distributed under the License is distributed on an
|
|
|
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
|
|
* KIND, either express or implied. See the License for the
|
|
|
|
* specific language governing permissions and limitations
|
|
|
|
* under the License.
|
|
|
|
*/
|
|
|
|
|
2019-07-10 18:42:28 -04:00
|
|
|
|
2018-10-03 05:37:36 -04:00
|
|
|
import org.elasticsearch.gradle.MavenFilteringHack
|
2019-11-01 14:33:11 -04:00
|
|
|
import org.elasticsearch.gradle.info.BuildParams
|
2018-10-03 05:37:36 -04:00
|
|
|
import org.elasticsearch.gradle.test.AntFixture
|
|
|
|
|
2019-07-10 18:42:28 -04:00
|
|
|
import static org.elasticsearch.gradle.PropertyNormalization.IGNORE_VALUE
|
|
|
|
|
2020-07-29 12:20:19 -04:00
|
|
|
apply plugin: 'elasticsearch.yaml-rest-test'
|
2018-10-03 05:37:36 -04:00
|
|
|
|
|
|
|
final int gceNumberOfNodes = 3
|
|
|
|
|
|
|
|
dependencies {
|
2020-07-29 12:20:19 -04:00
|
|
|
yamlRestTestImplementation project(':plugins:discovery-gce')
|
2018-10-03 05:37:36 -04:00
|
|
|
}
|
|
|
|
|
2020-03-19 13:28:59 -04:00
|
|
|
restResources {
|
|
|
|
restApi {
|
|
|
|
includeCore '_common', 'cluster', 'nodes'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-10-03 05:37:36 -04:00
|
|
|
/** A task to start the GCEFixture which emulates a GCE service **/
|
|
|
|
task gceFixture(type: AntFixture) {
|
2020-07-29 12:20:19 -04:00
|
|
|
dependsOn project.sourceSets.yamlRestTest.runtimeClasspath
|
|
|
|
env 'CLASSPATH', "${-> project.sourceSets.yamlRestTest.runtimeClasspath.asPath}"
|
2019-11-14 06:01:23 -05:00
|
|
|
executable = "${BuildParams.runtimeJavaHome}/bin/java"
|
2020-07-29 12:20:19 -04:00
|
|
|
args 'org.elasticsearch.cloud.gce.GCEFixture', baseDir, "${buildDir}/testclusters/yamlRestTest-1/config/unicast_hosts.txt"
|
2018-10-03 05:37:36 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
Map<String, Object> expansions = [
|
2019-11-14 06:01:23 -05:00
|
|
|
'expected_nodes': gceNumberOfNodes
|
2018-10-03 05:37:36 -04:00
|
|
|
]
|
|
|
|
|
2020-07-31 07:09:04 -04:00
|
|
|
tasks.named("processYamlRestTestResources").configure {
|
2019-11-14 06:01:23 -05:00
|
|
|
inputs.properties(expansions)
|
|
|
|
MavenFilteringHack.filter(it, expansions)
|
2018-10-03 05:37:36 -04:00
|
|
|
}
|
|
|
|
|
2020-07-29 12:20:19 -04:00
|
|
|
yamlRestTest {
|
2020-09-03 22:26:44 -04:00
|
|
|
dependsOn gceFixture
|
2019-04-26 11:34:03 -04:00
|
|
|
}
|
2018-10-03 05:37:36 -04:00
|
|
|
|
2020-07-29 12:20:19 -04:00
|
|
|
testClusters.yamlRestTest {
|
2019-11-14 06:01:23 -05:00
|
|
|
numberOfNodes = gceNumberOfNodes
|
2020-09-03 22:26:44 -04:00
|
|
|
plugin ':plugins:discovery-gce'
|
2019-11-14 06:01:23 -05:00
|
|
|
// use gce fixture for Auth calls instead of http://metadata.google.internal
|
|
|
|
environment 'GCE_METADATA_HOST', { "http://${gceFixture.addressAndPort}" }, IGNORE_VALUE
|
|
|
|
// allows to configure hidden settings (`cloud.gce.host` and `cloud.gce.root_url`)
|
|
|
|
systemProperty 'es.allow_reroute_gce_settings', 'true'
|
2018-10-03 05:37:36 -04:00
|
|
|
|
2019-11-14 06:01:23 -05:00
|
|
|
setting 'discovery.seed_providers', 'gce'
|
|
|
|
// use gce fixture for metadata server calls instead of http://metadata.google.internal
|
|
|
|
setting 'cloud.gce.host', { "http://${gceFixture.addressAndPort}" }, IGNORE_VALUE
|
|
|
|
// use gce fixture for API calls instead of https://www.googleapis.com
|
|
|
|
setting 'cloud.gce.root_url', { "http://${gceFixture.addressAndPort}" }, IGNORE_VALUE
|
2018-10-03 05:37:36 -04:00
|
|
|
}
|