Differentiate base paths in repository integration tests (#47284) (#47300)

This commit change the repositories base paths used in Azure/S3/GCS
integration tests so that they don't conflict with each other when tests
 run in parallel on real storage services.

Closes #47202
This commit is contained in:
Tanguy Leroux 2019-10-01 08:39:55 +02:00 committed by GitHub
parent dd0af2e425
commit f5c5411fe8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 25 additions and 11 deletions

View File

@ -88,7 +88,7 @@ task thirdPartyTest(type: Test) {
systemProperty 'test.azure.key', azureKey ? azureKey : ""
systemProperty 'test.azure.sas_token', azureSasToken ? azureSasToken : ""
systemProperty 'test.azure.container', azureContainer ? azureContainer : ""
systemProperty 'test.azure.base', azureBasePath ? azureBasePath : ""
systemProperty 'test.azure.base', (azureBasePath ? azureBasePath : "") + "_third_party_tests_" + project.testSeed
}
if (azureAccount || azureKey || azureContainer || azureBasePath || azureSasToken) {

View File

@ -54,7 +54,7 @@ task azureStorageFixture(type: AntFixture) {
Map<String, Object> expansions = [
'container': azureContainer,
'base_path': azureBasePath
'base_path': azureBasePath + "_integration_tests"
]
processTestResources {

View File

@ -15,9 +15,6 @@ setup:
---
"Snapshot/Restore with repository-azure":
- skip:
version: "all"
reason: "AwaitsFix https://github.com/elastic/elasticsearch/issues/47201"
# Get repository
- do:

View File

@ -137,7 +137,7 @@ task thirdPartyTest(type: Test) {
include '**/GoogleCloudStorageThirdPartyTests.class'
systemProperty 'test.google.account', gcsServiceAccount ? Base64.encoder.encodeToString(Files.readAllBytes(file(gcsServiceAccount).toPath())) : ""
systemProperty 'test.google.bucket', gcsBucket ? gcsBucket : ""
systemProperty 'test.google.base', gcsBasePath ? gcsBasePath : "/"
systemProperty 'test.google.base', (gcsBasePath ? gcsBasePath : "/") + "_third_party_tests_" + project.testSeed
}
if (gcsServiceAccount || gcsBucket || gcsBasePath) {

View File

@ -78,7 +78,7 @@ task createServiceAccountFile() {
Map<String, Object> expansions = [
'bucket': gcsBucket,
'base_path': gcsBasePath
'base_path': gcsBasePath + "_integration_tests"
]
processTestResources {

View File

@ -46,9 +46,16 @@ public class HdfsRepositoryTests extends AbstractThirdPartyRepositoryTestCase {
return new MockSecureSettings();
}
@Override
public void tearDown() throws Exception {
if (isJava11() == false) {
super.tearDown();
}
}
@Override
protected void createRepository(String repoName) {
assumeFalse("https://github.com/elastic/elasticsearch/issues/31498", JavaVersion.current().equals(JavaVersion.parse("11")));
assumeFalse("https://github.com/elastic/elasticsearch/issues/31498", isJava11());
AcknowledgedResponse putRepositoryResponse = client().admin().cluster().preparePutRepository(repoName)
.setType("hdfs")
.setSettings(Settings.builder()
@ -70,4 +77,8 @@ public class HdfsRepositoryTests extends AbstractThirdPartyRepositoryTestCase {
assertThat(response.result().blobs(), equalTo(0L));
}
}
private static boolean isJava11() {
return JavaVersion.current().equals(JavaVersion.parse("11"));
}
}

View File

@ -141,7 +141,7 @@ task thirdPartyTest(type: Test) {
systemProperty 'test.s3.account', s3PermanentAccessKey
systemProperty 'test.s3.key', s3PermanentSecretKey
systemProperty 'test.s3.bucket', s3PermanentBucket
systemProperty 'test.s3.base', s3PermanentBasePath
systemProperty 'test.s3.base', s3PermanentBasePath + "_third_party_tests_" + project.testSeed
}
if (useFixture) {
@ -255,9 +255,9 @@ task s3Fixture(type: AntFixture) {
processTestResources {
Map<String, Object> expansions = [
'permanent_bucket': s3PermanentBucket,
'permanent_base_path': s3PermanentBasePath,
'permanent_base_path': s3PermanentBasePath + "_integration_tests",
'temporary_bucket': s3TemporaryBucket,
'temporary_base_path': s3TemporaryBasePath,
'temporary_base_path': s3TemporaryBasePath + "_integration_tests",
'ec2_bucket': s3EC2Bucket,
'ec2_base_path': s3EC2BasePath,
'ecs_bucket': s3ECSBucket,

View File

@ -72,6 +72,12 @@ public abstract class AbstractThirdPartyRepositoryTestCase extends ESSingleNodeT
deleteAndAssertEmpty(getRepository().basePath());
}
@Override
public void tearDown() throws Exception {
deleteAndAssertEmpty(getRepository().basePath());
super.tearDown();
}
private void deleteAndAssertEmpty(BlobPath path) throws Exception {
final BlobStoreRepository repo = getRepository();
final PlainActionFuture<Void> future = PlainActionFuture.newFuture();