Skip to content

Commit 88ff69b

Browse files
Fix and Reenable SnapshotTool Minio Tests (#50736)
This solves half of the problem in #46813 by moving the S3 tests to using the shared minio fixture so we at least have some non-3rd-party, constantly running coverage on these tests.
1 parent d3cd4fb commit 88ff69b

File tree

4 files changed

+21
-41
lines changed

4 files changed

+21
-41
lines changed

plugins/repository-s3/build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ task thirdPartyTest(type: Test) {
141141
}
142142

143143
if (useFixture) {
144-
testFixtures.useFixture(':test:fixtures:minio-fixture')
144+
testFixtures.useFixture(':test:fixtures:minio-fixture', 'minio-fixture')
145145

146146
def minioAddress = {
147147
int minioPort = project(':test:fixtures:minio-fixture').postProcessFixture.ext."test.fixtures.minio-fixture.tcp.9000"

test/fixtures/minio-fixture/docker-compose.yml

+12
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,15 @@ services:
1111
ports:
1212
- "9000"
1313
command: ["server", "/minio/data"]
14+
15+
minio-fixture-for-snapshot-tool:
16+
build:
17+
context: .
18+
args:
19+
bucket: "bucket"
20+
accessKey: "sn_tool_access_key"
21+
secretKey: "sn_tool_secret_key"
22+
dockerfile: Dockerfile
23+
ports:
24+
- "9000"
25+
command: ["server", "/minio/data"]

x-pack/snapshot-tool/qa/s3/build.gradle

+8-31
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
* you may not use this file except in compliance with the Elastic License.
55
*/
66
apply plugin: 'elasticsearch.build'
7+
apply plugin: 'elasticsearch.test.fixtures'
78

89
dependencies {
910
compile project(":plugins:repository-s3")
@@ -26,9 +27,9 @@ String s3PermanentBucket = System.getenv("amazon_s3_bucket")
2627
String s3PermanentBasePath = System.getenv("amazon_s3_base_path")
2728

2829
if (!s3PermanentAccessKey && !s3PermanentSecretKey && !s3PermanentBucket && !s3PermanentBasePath) {
29-
s3PermanentAccessKey = 's3_integration_test_permanent_access_key'
30-
s3PermanentSecretKey = 's3_integration_test_permanent_secret_key'
31-
s3PermanentBucket = 'permanent-bucket-test'
30+
s3PermanentAccessKey = 'sn_tool_access_key'
31+
s3PermanentSecretKey = 'sn_tool_secret_key'
32+
s3PermanentBucket = 'bucket'
3233
s3PermanentBasePath = 'integration_test'
3334

3435
useS3Fixture = true
@@ -48,41 +49,17 @@ task thirdPartyTest(type: Test) {
4849
}
4950

5051
if (useS3Fixture) {
51-
thirdPartyTest.enabled = false;
5252
testingConventions.enabled = false;
53-
/*
54-
55-
See: https://github.com/elastic/elasticsearch/issues/46813 Fails with --parallel
56-
57-
apply plugin: 'elasticsearch.test.fixtures'
58-
59-
testFixtures.useFixture()
60-
61-
task writeDockerFile {
62-
File minioDockerfile = new File("${project.buildDir}/minio-docker/Dockerfile")
63-
outputs.file(minioDockerfile)
64-
doLast {
65-
minioDockerfile.parentFile.mkdirs()
66-
minioDockerfile.text =
67-
"FROM minio/minio:RELEASE.2019-01-23T23-18-58Z\n" +
68-
"RUN mkdir -p /minio/data/${s3PermanentBucket}\n" +
69-
"ENV MINIO_ACCESS_KEY ${s3PermanentAccessKey}\n" +
70-
"ENV MINIO_SECRET_KEY ${s3PermanentSecretKey}"
71-
}
72-
}
73-
74-
preProcessFixture {
75-
dependsOn(writeDockerFile)
76-
}
53+
testFixtures.useFixture(':test:fixtures:minio-fixture', "minio-fixture-for-snapshot-tool")
7754

7855
def minioAddress = {
79-
int minioPort = postProcessFixture.ext."test.fixtures.minio-fixture.tcp.9000"
56+
int minioPort = project(':test:fixtures:minio-fixture').postProcessFixture.ext."test.fixtures.minio-fixture-for-snapshot-tool.tcp.9000"
8057
assert minioPort > 0
8158
'http://127.0.0.1:' + minioPort
8259
}
8360

8461
thirdPartyTest {
85-
dependsOn tasks.postProcessFixture
62+
dependsOn project(':test:fixtures:minio-fixture').postProcessFixture
8663
nonInputProperties.systemProperty 'test.s3.endpoint', "${-> minioAddress.call()}"
8764
}
8865

@@ -91,7 +68,7 @@ if (useS3Fixture) {
9168
throw new IllegalStateException("Tried to run third party tests but not all of the necessary environment variables 'amazon_s3_access_key', " +
9269
"'amazon_s3_secret_key', 'amazon_s3_bucket', and 'amazon_s3_base_path' are set.");
9370
}
94-
}*/
71+
}
9572
}
9673

9774
check.dependsOn(thirdPartyTest)

x-pack/snapshot-tool/qa/s3/docker-compose.yml

-9
This file was deleted.

0 commit comments

Comments
 (0)