|
@@ -22,15 +22,14 @@ import org.elasticsearch.gradle.MavenFilteringHack
|
|
|
import org.elasticsearch.gradle.info.BuildParams
|
|
|
import org.elasticsearch.gradle.test.AntFixture
|
|
|
import org.elasticsearch.gradle.test.RestIntegTestTask
|
|
|
+import org.elasticsearch.gradle.test.rest.YamlRestTestPlugin
|
|
|
|
|
|
import static org.elasticsearch.gradle.PropertyNormalization.IGNORE_VALUE
|
|
|
|
|
|
-apply plugin: 'elasticsearch.standalone-rest-test'
|
|
|
-apply plugin: 'elasticsearch.rest-test'
|
|
|
-apply plugin: 'elasticsearch.rest-resources'
|
|
|
+apply plugin: 'elasticsearch.yaml-rest-test'
|
|
|
|
|
|
dependencies {
|
|
|
- testImplementation project(':plugins:discovery-ec2')
|
|
|
+ yamlRestTestImplementation project(':plugins:discovery-ec2')
|
|
|
}
|
|
|
|
|
|
restResources {
|
|
@@ -45,13 +44,13 @@ Map<String, Object> expansions = [
|
|
|
'expected_nodes': ec2NumberOfNodes
|
|
|
]
|
|
|
|
|
|
-processTestResources {
|
|
|
+processYamlRestTestResources {
|
|
|
inputs.properties(expansions)
|
|
|
MavenFilteringHack.filter(it, expansions)
|
|
|
}
|
|
|
|
|
|
-// disable default test task, use spezialized ones below
|
|
|
-integTest.enabled = false
|
|
|
+// disable default yamlRestTest task, use spezialized ones below
|
|
|
+yamlRestTest.enabled = false
|
|
|
|
|
|
/*
|
|
|
* Test using various credential providers (see also https://docs.aws.amazon.com/sdk-for-java/v2/developer-guide/credentials.html):
|
|
@@ -66,19 +65,26 @@ integTest.enabled = false
|
|
|
*/
|
|
|
['KeyStore', 'EnvVariables', 'SystemProperties', 'ContainerCredentials', 'InstanceProfile'].forEach { action ->
|
|
|
AntFixture fixture = tasks.create(name: "ec2Fixture${action}", type: AntFixture) {
|
|
|
- dependsOn compileTestJava
|
|
|
- env 'CLASSPATH', "${-> project.sourceSets.test.runtimeClasspath.asPath}"
|
|
|
+ dependsOn project.sourceSets.yamlRestTest.runtimeClasspath
|
|
|
+ env 'CLASSPATH', "${-> project.sourceSets.yamlRestTest.runtimeClasspath.asPath}"
|
|
|
executable = "${BuildParams.runtimeJavaHome}/bin/java"
|
|
|
- args 'org.elasticsearch.discovery.ec2.AmazonEC2Fixture', baseDir, "${buildDir}/testclusters/integTest${action}-1/config/unicast_hosts.txt"
|
|
|
+ args 'org.elasticsearch.discovery.ec2.AmazonEC2Fixture', baseDir, "${buildDir}/testclusters/yamlRestTest${action}-1/config/unicast_hosts.txt"
|
|
|
}
|
|
|
|
|
|
- tasks.create(name: "integTest${action}", type: RestIntegTestTask) {
|
|
|
+ tasks.create(name: "yamlRestTest${action}", type: RestIntegTestTask) {
|
|
|
dependsOn fixture, project(':plugins:discovery-ec2').bundlePlugin
|
|
|
}
|
|
|
+ SourceSetContainer sourceSets = project.getExtensions().getByType(SourceSetContainer.class);
|
|
|
+ SourceSet yamlRestTestSourceSet = sourceSets.getByName(YamlRestTestPlugin.SOURCE_SET_NAME)
|
|
|
+ "yamlRestTest${action}" {
|
|
|
+ runner {
|
|
|
+ setTestClassesDirs(yamlRestTestSourceSet.getOutput().getClassesDirs())
|
|
|
+ setClasspath(yamlRestTestSourceSet.getRuntimeClasspath())
|
|
|
+ }
|
|
|
+ }
|
|
|
+ check.dependsOn("yamlRestTest${action}")
|
|
|
|
|
|
- check.dependsOn("integTest${action}")
|
|
|
-
|
|
|
- testClusters."integTest${action}" {
|
|
|
+ testClusters."yamlRestTest${action}" {
|
|
|
numberOfNodes = ec2NumberOfNodes
|
|
|
plugin project(':plugins:discovery-ec2').bundlePlugin.archiveFile
|
|
|
|
|
@@ -91,19 +97,19 @@ integTest.enabled = false
|
|
|
}
|
|
|
|
|
|
// Extra config for KeyStore
|
|
|
-testClusters.integTestKeyStore {
|
|
|
+testClusters.yamlRestTestKeyStore {
|
|
|
keystore 'discovery.ec2.access_key', 'ec2_integration_test_access_key'
|
|
|
keystore 'discovery.ec2.secret_key', 'ec2_integration_test_secret_key'
|
|
|
}
|
|
|
|
|
|
// Extra config for EnvVariables
|
|
|
-testClusters.integTestEnvVariables {
|
|
|
+testClusters.yamlRestTestEnvVariables {
|
|
|
environment 'AWS_ACCESS_KEY_ID', 'ec2_integration_test_access_key'
|
|
|
environment 'AWS_SECRET_ACCESS_KEY', 'ec2_integration_test_secret_key'
|
|
|
}
|
|
|
|
|
|
// Extra config for SystemProperties
|
|
|
-testClusters.integTestSystemProperties {
|
|
|
+testClusters.yamlRestTestSystemProperties {
|
|
|
systemProperty 'aws.accessKeyId', 'ec2_integration_test_access_key'
|
|
|
systemProperty 'aws.secretKey', 'ec2_integration_test_secret_key'
|
|
|
}
|
|
@@ -111,7 +117,7 @@ testClusters.integTestSystemProperties {
|
|
|
// Extra config for ContainerCredentials
|
|
|
ec2FixtureContainerCredentials.env 'ACTIVATE_CONTAINER_CREDENTIALS', true
|
|
|
|
|
|
-testClusters.integTestContainerCredentials {
|
|
|
+testClusters.yamlRestTestContainerCredentials {
|
|
|
environment 'AWS_CONTAINER_CREDENTIALS_FULL_URI',
|
|
|
{ "http://${-> tasks.findByName("ec2FixtureContainerCredentials").addressAndPort}/ecs_credentials_endpoint" }, IGNORE_VALUE
|
|
|
}
|