Skip to content

Commit b77da88

Browse files
committed
[Tests] Fix third party tests with Gradle 5.0 (#36302)
This pull request fixes the build.gradle file so that it works with the Gradle 5.0 update (#34263). It also makes use of the ignore: 404 header in REST tests so that previous snapshots are deleted as part of the test set up. This way each new test run with an external service should start with a fresh repository even if the previous test run failed and left snapshots in the repo. (This is a best effort as it does not fix a corrupted repository)
1 parent c8c9aa3 commit b77da88

File tree

3 files changed

+37
-9
lines changed

3 files changed

+37
-9
lines changed

plugins/repository-gcs/qa/google-cloud-storage/src/test/resources/rest-api-spec/test/repository_gcs/10_repository.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,19 @@ setup:
1313
client: "integration_test"
1414
base_path: "${base_path}"
1515

16+
# Remove the snapshots, if a previous test failed to delete them. This is
17+
# useful for third party tests that runs the test against a real external service.
18+
- do:
19+
snapshot.delete:
20+
repository: repository
21+
snapshot: snapshot-one
22+
ignore: 404
23+
- do:
24+
snapshot.delete:
25+
repository: repository
26+
snapshot: snapshot-two
27+
ignore: 404
28+
1629
---
1730
"Snapshot/Restore with repository-gcs":
1831

plugins/repository-s3/build.gradle

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -109,20 +109,12 @@ String s3ECSBasePath = System.getenv("amazon_s3_base_path_ecs")
109109
// If all these variables are missing then we are testing against the internal fixture instead, which has the following
110110
// credentials hard-coded in.
111111

112-
if (!s3PermanentAccessKey && !s3PermanentSecretKey && !s3PermanentBucket && !s3PermanentBasePath
113-
&& !s3EC2Bucket && !s3EC2BasePath
114-
&& !s3ECSBucket && !s3ECSBasePath) {
112+
if (!s3PermanentAccessKey && !s3PermanentSecretKey && !s3PermanentBucket && !s3PermanentBasePath) {
115113
s3PermanentAccessKey = 's3_integration_test_permanent_access_key'
116114
s3PermanentSecretKey = 's3_integration_test_permanent_secret_key'
117115
s3PermanentBucket = 'permanent-bucket-test'
118116
s3PermanentBasePath = 'integration_test'
119117

120-
s3EC2Bucket = 'ec2-bucket-test'
121-
s3EC2BasePath = 'integration_test'
122-
123-
s3ECSBucket = 'ecs-bucket-test'
124-
s3ECSBasePath = 'integration_test'
125-
126118
useFixture = true
127119

128120
} else if (!s3PermanentAccessKey || !s3PermanentSecretKey || !s3PermanentBucket || !s3PermanentBasePath) {
@@ -140,6 +132,16 @@ if (!s3TemporaryAccessKey && !s3TemporarySecretKey && !s3TemporaryBucket && !s3T
140132
throw new IllegalArgumentException("not all options specified to run against external S3 service as temporary credentials are present")
141133
}
142134

135+
if (!s3EC2Bucket && !s3EC2BasePath && !s3ECSBucket && !s3ECSBasePath) {
136+
s3EC2Bucket = 'ec2-bucket-test'
137+
s3EC2BasePath = 'integration_test'
138+
s3ECSBucket = 'ecs-bucket-test'
139+
s3ECSBasePath = 'integration_test'
140+
} else if (!s3EC2Bucket || !s3EC2BasePath || !s3ECSBucket || !s3ECSBasePath) {
141+
throw new IllegalArgumentException("not all options specified to run EC2/ECS tests are present")
142+
}
143+
144+
143145
final String minioVersion = 'RELEASE.2018-06-22T23-48-46Z'
144146
final String minioBinDir = "${buildDir}/minio/bin"
145147
final String minioDataDir = "${buildDir}/minio/data"

plugins/repository-s3/src/test/resources/rest-api-spec/test/repository_s3/20_repository_permanent_credentials.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,19 @@ setup:
1616
canned_acl: private
1717
storage_class: standard
1818

19+
# Remove the snapshots, if a previous test failed to delete them. This is
20+
# useful for third party tests that runs the test against a real external service.
21+
- do:
22+
snapshot.delete:
23+
repository: repository_permanent
24+
snapshot: snapshot-one
25+
ignore: 404
26+
- do:
27+
snapshot.delete:
28+
repository: repository_permanent
29+
snapshot: snapshot-two
30+
ignore: 404
31+
1932
---
2033
"Snapshot and Restore with repository-s3 using permanent credentials":
2134
- skip:

0 commit comments

Comments
 (0)