Skip to content

Commit 4c90ec6

Browse files
authored
Differentiate base paths in repository integration tests (#47284)
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
1 parent 4ebb44f commit 4c90ec6

File tree

9 files changed

+27
-37
lines changed

9 files changed

+27
-37
lines changed

plugins/repository-azure/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ task thirdPartyTest(type: Test) {
8888
systemProperty 'test.azure.key', azureKey ? azureKey : ""
8989
systemProperty 'test.azure.sas_token', azureSasToken ? azureSasToken : ""
9090
systemProperty 'test.azure.container', azureContainer ? azureContainer : ""
91-
systemProperty 'test.azure.base', azureBasePath ? azureBasePath : ""
91+
systemProperty 'test.azure.base', (azureBasePath ? azureBasePath : "") + "_third_party_tests_" + project.testSeed
9292
}
9393

9494
if (azureAccount || azureKey || azureContainer || azureBasePath || azureSasToken) {

plugins/repository-azure/qa/microsoft-azure-storage/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ task azureStorageFixture(type: AntFixture) {
5454

5555
Map<String, Object> expansions = [
5656
'container': azureContainer,
57-
'base_path': azureBasePath
57+
'base_path': azureBasePath + "_integration_tests"
5858
]
5959

6060
processTestResources {

plugins/repository-azure/qa/microsoft-azure-storage/src/test/resources/rest-api-spec/test/repository_azure/10_repository.yml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,8 @@ setup:
1616
---
1717
"Snapshot/Restore with repository-azure":
1818
- skip:
19-
version: "all"
20-
reason: "AwaitsFix https://github.com/elastic/elasticsearch/issues/47201"
21-
# BELOW 3 lines to be uncommented when un-muting
22-
# - skip:
23-
# version: " - 7.9.99"
24-
# reason: "8.0 changes get snapshots response format"
19+
version: " - 7.9.99"
20+
reason: "8.0 changes get snapshots response format"
2521

2622
# Get repository
2723
- do:

plugins/repository-azure/src/test/java/org/elasticsearch/repositories/azure/AzureStorageCleanupThirdPartyTests.java

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -109,25 +109,4 @@ private void ensureSasTokenPermissions() {
109109
}));
110110
future.actionGet();
111111
}
112-
113-
// override here to mute only for Azure, please remove this overload when un-muting
114-
@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/47202")
115-
@Override
116-
public void testCreateSnapshot() {
117-
super.testCreateSnapshot();
118-
}
119-
120-
// override here to mute only for Azure, please remove this overload when un-muting
121-
@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/47202")
122-
@Override
123-
public void testCleanup() throws Exception {
124-
super.testCleanup();
125-
}
126-
127-
// override here to mute only for Azure, please remove this overload when un-muting
128-
@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/47202")
129-
@Override
130-
public void testListChildren() throws Exception {
131-
super.testListChildren();
132-
}
133112
}

plugins/repository-gcs/build.gradle

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import java.nio.file.Files
2-
31
/*
42
* Licensed to Elasticsearch under one or more contributor
53
* license agreements. See the NOTICE file distributed with

plugins/repository-gcs/qa/google-cloud-storage/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ task thirdPartyTest (type: Test) {
8989
include '**/GoogleCloudStorageThirdPartyTests.class'
9090
systemProperty 'tests.security.manager', false
9191
systemProperty 'test.google.bucket', gcsBucket
92-
systemProperty 'test.google.base', gcsBasePath
92+
systemProperty 'test.google.base', gcsBasePath + "_third_party_tests_" + project.testSeed
9393
nonInputProperties.systemProperty 'test.google.account', "${ -> encodedCredentials.call() }"
9494
}
9595

@@ -128,7 +128,7 @@ check.dependsOn thirdPartyTest
128128

129129
Map<String, Object> expansions = [
130130
'bucket': gcsBucket,
131-
'base_path': gcsBasePath
131+
'base_path': gcsBasePath + "_integration_tests"
132132
]
133133

134134
processTestResources {

plugins/repository-hdfs/src/test/java/org/elasticsearch/repositories/hdfs/HdfsRepositoryTests.java

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,16 @@ protected SecureSettings credentials() {
4646
return new MockSecureSettings();
4747
}
4848

49+
@Override
50+
public void tearDown() throws Exception {
51+
if (isJava11() == false) {
52+
super.tearDown();
53+
}
54+
}
55+
4956
@Override
5057
protected void createRepository(String repoName) {
51-
assumeFalse("https://github.com/elastic/elasticsearch/issues/31498", JavaVersion.current().equals(JavaVersion.parse("11")));
58+
assumeFalse("https://github.com/elastic/elasticsearch/issues/31498", isJava11());
5259
AcknowledgedResponse putRepositoryResponse = client().admin().cluster().preparePutRepository(repoName)
5360
.setType("hdfs")
5461
.setSettings(Settings.builder()
@@ -70,4 +77,8 @@ protected void assertCleanupResponse(CleanupRepositoryResponse response, long by
7077
assertThat(response.result().blobs(), equalTo(0L));
7178
}
7279
}
80+
81+
private static boolean isJava11() {
82+
return JavaVersion.current().equals(JavaVersion.parse("11"));
83+
}
7384
}

plugins/repository-s3/build.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ task thirdPartyTest(type: Test) {
134134
systemProperty 'test.s3.account', s3PermanentAccessKey
135135
systemProperty 'test.s3.key', s3PermanentSecretKey
136136
systemProperty 'test.s3.bucket', s3PermanentBucket
137-
systemProperty 'test.s3.base', s3PermanentBasePath
137+
systemProperty 'test.s3.base', s3PermanentBasePath + "_third_party_tests_" + project.testSeed
138138
}
139139

140140
if (useFixture) {
@@ -248,9 +248,9 @@ task s3Fixture(type: AntFixture) {
248248
processTestResources {
249249
Map<String, Object> expansions = [
250250
'permanent_bucket': s3PermanentBucket,
251-
'permanent_base_path': s3PermanentBasePath,
251+
'permanent_base_path': s3PermanentBasePath + "_integration_tests",
252252
'temporary_bucket': s3TemporaryBucket,
253-
'temporary_base_path': s3TemporaryBasePath,
253+
'temporary_base_path': s3TemporaryBasePath + "_integration_tests",
254254
'ec2_bucket': s3EC2Bucket,
255255
'ec2_base_path': s3EC2BasePath,
256256
'ecs_bucket': s3ECSBucket,

test/framework/src/main/java/org/elasticsearch/repositories/AbstractThirdPartyRepositoryTestCase.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,12 @@ public void setUp() throws Exception {
7373
deleteAndAssertEmpty(getRepository().basePath());
7474
}
7575

76+
@Override
77+
public void tearDown() throws Exception {
78+
deleteAndAssertEmpty(getRepository().basePath());
79+
super.tearDown();
80+
}
81+
7682
private void deleteAndAssertEmpty(BlobPath path) throws Exception {
7783
final BlobStoreRepository repo = getRepository();
7884
final PlainActionFuture<Void> future = PlainActionFuture.newFuture();

0 commit comments

Comments
 (0)