|  | @@ -1,6 +1,8 @@
 | 
	
		
			
				|  |  |  import org.elasticsearch.gradle.MavenFilteringHack
 | 
	
		
			
				|  |  |  import org.elasticsearch.gradle.info.BuildParams
 | 
	
		
			
				|  |  |  import org.elasticsearch.gradle.test.RestIntegTestTask
 | 
	
		
			
				|  |  | +import org.elasticsearch.gradle.test.rest.YamlRestTestPlugin
 | 
	
		
			
				|  |  | +import org.elasticsearch.gradle.test.InternalClusterTestPlugin
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  import static org.elasticsearch.gradle.PropertyNormalization.IGNORE_VALUE
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -22,7 +24,8 @@ import static org.elasticsearch.gradle.PropertyNormalization.IGNORE_VALUE
 | 
	
		
			
				|  |  |   * specific language governing permissions and limitations
 | 
	
		
			
				|  |  |   * under the License.
 | 
	
		
			
				|  |  |   */
 | 
	
		
			
				|  |  | -apply plugin: 'elasticsearch.rest-resources'
 | 
	
		
			
				|  |  | +apply plugin: 'elasticsearch.yaml-rest-test'
 | 
	
		
			
				|  |  | +apply plugin: 'elasticsearch.internal-cluster-test'
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  esplugin {
 | 
	
		
			
				|  |  |    description 'The S3 repository plugin adds S3 repositories'
 | 
	
	
		
			
				|  | @@ -55,6 +58,12 @@ dependencies {
 | 
	
		
			
				|  |  |    testImplementation project(':test:fixtures:s3-fixture')
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +restResources {
 | 
	
		
			
				|  |  | +  restApi {
 | 
	
		
			
				|  |  | +    includeCore '_common', 'cluster', 'nodes', 'snapshot','indices', 'index', 'bulk', 'count'
 | 
	
		
			
				|  |  | +  }
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  tasks.named("dependencyLicenses").configure {
 | 
	
		
			
				|  |  |    mapping from: /aws-java-sdk-.*/, to: 'aws-java-sdk'
 | 
	
		
			
				|  |  |    mapping from: /jmespath-java.*/, to: 'aws-java-sdk'
 | 
	
	
		
			
				|  | @@ -135,7 +144,7 @@ if (!s3EC2Bucket && !s3EC2BasePath && !s3ECSBucket && !s3ECSBasePath) {
 | 
	
		
			
				|  |  |    throw new IllegalArgumentException("not all options specified to run EC2/ECS tests are present")
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -processTestResources {
 | 
	
		
			
				|  |  | +processYamlRestTestResources {
 | 
	
		
			
				|  |  |    Map<String, Object> expansions = [
 | 
	
		
			
				|  |  |      'permanent_bucket'        : s3PermanentBucket,
 | 
	
		
			
				|  |  |      'permanent_base_path'     : s3PermanentBasePath + "_integration_tests",
 | 
	
	
		
			
				|  | @@ -151,13 +160,12 @@ processTestResources {
 | 
	
		
			
				|  |  |    MavenFilteringHack.filter(it, expansions)
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -test {
 | 
	
		
			
				|  |  | +internalClusterTest {
 | 
	
		
			
				|  |  |    // this is tested explicitly in a separate test task
 | 
	
		
			
				|  |  |    exclude '**/S3RepositoryThirdPartyTests.class'
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -// IntegTest
 | 
	
		
			
				|  |  | -integTest {
 | 
	
		
			
				|  |  | +yamlRestTest {
 | 
	
		
			
				|  |  |    runner {
 | 
	
		
			
				|  |  |      systemProperty 'tests.rest.blacklist', (
 | 
	
		
			
				|  |  |        useFixture ?
 | 
	
	
		
			
				|  | @@ -172,7 +180,7 @@ integTest {
 | 
	
		
			
				|  |  |    }
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -testClusters.integTest {
 | 
	
		
			
				|  |  | +testClusters.yamlRestTest {
 | 
	
		
			
				|  |  |    keystore 's3.client.integration_test_permanent.access_key', s3PermanentAccessKey
 | 
	
		
			
				|  |  |    keystore 's3.client.integration_test_permanent.secret_key', s3PermanentSecretKey
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -207,10 +215,15 @@ testClusters.integTest {
 | 
	
		
			
				|  |  |  if (useFixture) {
 | 
	
		
			
				|  |  |    testFixtures.useFixture(':test:fixtures:minio-fixture', 'minio-fixture')
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -  task integTestMinio(type: RestIntegTestTask) {
 | 
	
		
			
				|  |  | +  task yamlRestTestMinio(type: RestIntegTestTask) {
 | 
	
		
			
				|  |  |      description = "Runs REST tests using the Minio repository."
 | 
	
		
			
				|  |  |      dependsOn tasks.bundlePlugin
 | 
	
		
			
				|  |  |      runner {
 | 
	
		
			
				|  |  | +      SourceSetContainer sourceSets = project.getExtensions().getByType(SourceSetContainer.class);
 | 
	
		
			
				|  |  | +      SourceSet yamlRestTestSourceSet = sourceSets.getByName(YamlRestTestPlugin.SOURCE_SET_NAME)
 | 
	
		
			
				|  |  | +      setTestClassesDirs(yamlRestTestSourceSet.getOutput().getClassesDirs())
 | 
	
		
			
				|  |  | +      setClasspath(yamlRestTestSourceSet.getRuntimeClasspath())
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |        // Minio only supports a single access key, see https://github.com/minio/minio/pull/5968
 | 
	
		
			
				|  |  |        systemProperty 'tests.rest.blacklist', [
 | 
	
		
			
				|  |  |          'repository_s3/30_repository_temporary_credentials/*',
 | 
	
	
		
			
				|  | @@ -219,9 +232,9 @@ if (useFixture) {
 | 
	
		
			
				|  |  |        ].join(",")
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |    }
 | 
	
		
			
				|  |  | -  check.dependsOn(integTestMinio)
 | 
	
		
			
				|  |  | +  check.dependsOn(yamlRestTestMinio)
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -  testClusters.integTestMinio {
 | 
	
		
			
				|  |  | +  testClusters.yamlRestTestMinio {
 | 
	
		
			
				|  |  |      keystore 's3.client.integration_test_permanent.access_key', s3PermanentAccessKey
 | 
	
		
			
				|  |  |      keystore 's3.client.integration_test_permanent.secret_key', s3PermanentSecretKey
 | 
	
		
			
				|  |  |      setting 's3.client.integration_test_permanent.endpoint', { "${-> fixtureAddress('minio-fixture', 'minio-fixture', '9000')}" }, IGNORE_VALUE
 | 
	
	
		
			
				|  | @@ -232,11 +245,14 @@ if (useFixture) {
 | 
	
		
			
				|  |  |  // ECS
 | 
	
		
			
				|  |  |  if (useFixture) {
 | 
	
		
			
				|  |  |    testFixtures.useFixture(':test:fixtures:s3-fixture', 's3-fixture-with-ecs')
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -  task integTestECS(type: RestIntegTestTask.class) {
 | 
	
		
			
				|  |  | +  task yamlRestTestECS(type: RestIntegTestTask.class) {
 | 
	
		
			
				|  |  |      description = "Runs tests using the ECS repository."
 | 
	
		
			
				|  |  |      dependsOn('bundlePlugin')
 | 
	
		
			
				|  |  |      runner {
 | 
	
		
			
				|  |  | +      SourceSetContainer sourceSets = project.getExtensions().getByType(SourceSetContainer.class);
 | 
	
		
			
				|  |  | +      SourceSet yamlRestTestSourceSet = sourceSets.getByName(YamlRestTestPlugin.SOURCE_SET_NAME)
 | 
	
		
			
				|  |  | +      setTestClassesDirs(yamlRestTestSourceSet.getOutput().getClassesDirs())
 | 
	
		
			
				|  |  | +      setClasspath(yamlRestTestSourceSet.getRuntimeClasspath())
 | 
	
		
			
				|  |  |        systemProperty 'tests.rest.blacklist', [
 | 
	
		
			
				|  |  |          'repository_s3/10_basic/*',
 | 
	
		
			
				|  |  |          'repository_s3/20_repository_permanent_credentials/*',
 | 
	
	
		
			
				|  | @@ -245,9 +261,9 @@ if (useFixture) {
 | 
	
		
			
				|  |  |        ].join(",")
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |    }
 | 
	
		
			
				|  |  | -  check.dependsOn(integTestECS)
 | 
	
		
			
				|  |  | +  check.dependsOn(yamlRestTestECS)
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -  testClusters.integTestECS {
 | 
	
		
			
				|  |  | +  testClusters.yamlRestTestECS {
 | 
	
		
			
				|  |  |      setting 's3.client.integration_test_ecs.endpoint', { "${-> fixtureAddress('s3-fixture', 's3-fixture-with-ecs', '80')}" }, IGNORE_VALUE
 | 
	
		
			
				|  |  |      plugin tasks.bundlePlugin.archiveFile
 | 
	
		
			
				|  |  |      environment 'AWS_CONTAINER_CREDENTIALS_FULL_URI', { "${-> fixtureAddress('s3-fixture', 's3-fixture-with-ecs', '80')}/ecs_credentials_endpoint" }, IGNORE_VALUE
 | 
	
	
		
			
				|  | @@ -256,16 +272,17 @@ if (useFixture) {
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  // 3rd Party Tests
 | 
	
		
			
				|  |  |  task s3ThirdPartyTest(type: Test) {
 | 
	
		
			
				|  |  | +  SourceSetContainer sourceSets = project.getExtensions().getByType(SourceSetContainer.class);
 | 
	
		
			
				|  |  | +  SourceSet internalTestSourceSet = sourceSets.getByName(InternalClusterTestPlugin.SOURCE_SET_NAME)
 | 
	
		
			
				|  |  | +  setTestClassesDirs(internalTestSourceSet.getOutput().getClassesDirs())
 | 
	
		
			
				|  |  | +  setClasspath(internalTestSourceSet.getRuntimeClasspath())
 | 
	
		
			
				|  |  |    include '**/S3RepositoryThirdPartyTests.class'
 | 
	
		
			
				|  |  |    systemProperty 'test.s3.account', s3PermanentAccessKey
 | 
	
		
			
				|  |  |    systemProperty 'test.s3.key', s3PermanentSecretKey
 | 
	
		
			
				|  |  |    systemProperty 'test.s3.bucket', s3PermanentBucket
 | 
	
		
			
				|  |  |    nonInputProperties.systemProperty 'test.s3.base', s3PermanentBasePath + "_third_party_tests_" + BuildParams.testSeed
 | 
	
		
			
				|  |  |    if (useFixture) {
 | 
	
		
			
				|  |  | -    dependsOn tasks.integTestMinio
 | 
	
		
			
				|  |  |      nonInputProperties.systemProperty 'test.s3.endpoint', "${-> fixtureAddress('minio-fixture', 'minio-fixture', '9000') }"
 | 
	
		
			
				|  |  | -  } else {
 | 
	
		
			
				|  |  | -    dependsOn tasks.integTest
 | 
	
		
			
				|  |  |    }
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  |  check.dependsOn(s3ThirdPartyTest)
 |