Skip to content

Commit a725896

Browse files
Fix and Reenable SnapshotTool Minio Tests (#50736) (#50745)
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 31158ab commit a725896

File tree

4 files changed

+28
-46
lines changed

4 files changed

+28
-46
lines changed

plugins/repository-s3/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ task thirdPartyTest(type: Test) {
148148
}
149149

150150
if (useFixture) {
151-
testFixtures.useFixture(':test:fixtures:minio-fixture')
151+
testFixtures.useFixture(':test:fixtures:minio-fixture', 'minio-fixture')
152152

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

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

Lines changed: 12 additions & 0 deletions
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

Lines changed: 15 additions & 36 deletions
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,48 +49,26 @@ 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-
task writeDockerFile {
60-
File minioDockerfile = new File("${project.buildDir}/minio-docker/Dockerfile")
61-
outputs.file(minioDockerfile)
62-
doLast {
63-
minioDockerfile.parentFile.mkdirs()
64-
minioDockerfile.text =
65-
"FROM minio/minio:RELEASE.2019-01-23T23-18-58Z\n" +
66-
"RUN mkdir -p /minio/data/${s3PermanentBucket}\n" +
67-
"ENV MINIO_ACCESS_KEY ${s3PermanentAccessKey}\n" +
68-
"ENV MINIO_SECRET_KEY ${s3PermanentSecretKey}"
69-
}
70-
}
71-
72-
preProcessFixture {
73-
dependsOn(writeDockerFile)
74-
}
53+
testFixtures.useFixture(':test:fixtures:minio-fixture', "minio-fixture-for-snapshot-tool")
7554

7655
def minioAddress = {
77-
int minioPort = postProcessFixture.ext."test.fixtures.minio-fixture.tcp.9000"
78-
assert minioPort > 0
79-
'http://127.0.0.1:' + minioPort
56+
int minioPort = project(':test:fixtures:minio-fixture').postProcessFixture.ext."test.fixtures.minio-fixture-for-snapshot-tool.tcp.9000"
57+
assert minioPort > 0
58+
'http://127.0.0.1:' + minioPort
8059
}
8160

8261
thirdPartyTest {
83-
dependsOn tasks.postProcessFixture
84-
nonInputProperties.systemProperty 'test.s3.endpoint', "${ -> minioAddress.call() }"
62+
dependsOn project(':test:fixtures:minio-fixture').postProcessFixture
63+
nonInputProperties.systemProperty 'test.s3.endpoint', "${-> minioAddress.call()}"
8564
}
8665

8766
gradle.taskGraph.whenReady {
88-
if (it.hasTask(s3ThirdPartyTests)) {
89-
throw new IllegalStateException("Tried to run third party tests but not all of the necessary environment variables 'amazon_s3_access_key', " +
90-
"'amazon_s3_secret_key', 'amazon_s3_bucket', and 'amazon_s3_base_path' are set.");
91-
}
92-
}*/
67+
if (it.hasTask(s3ThirdPartyTests)) {
68+
throw new IllegalStateException("Tried to run third party tests but not all of the necessary environment variables 'amazon_s3_access_key', " +
69+
"'amazon_s3_secret_key', 'amazon_s3_bucket', and 'amazon_s3_base_path' are set.");
70+
}
71+
}
9372
}
9473

9574
check.dependsOn(thirdPartyTest)

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

Lines changed: 0 additions & 9 deletions
This file was deleted.

0 commit comments

Comments
 (0)