Skip to content

Commit e92b170

Browse files
authored
Move MinIO fixture in its own project (#49037)
This commit moves the MinIO docker-compose fixture from the :plugins:repository-s3 to its own :test:minio-fixture Gradle project.
1 parent 902ab4f commit e92b170

File tree

5 files changed

+49
-24
lines changed

5 files changed

+49
-24
lines changed

plugins/repository-s3/build.gradle

+10-23
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ dependencies {
5050
// HACK: javax.xml.bind was removed from default modules in java 9, so we pull the api in here,
5151
// and whitelist this hack in JarHell
5252
compile 'javax.xml.bind:jaxb-api:2.2.2'
53+
54+
testCompile project(':test:fixtures:minio-fixture')
5355
}
5456

5557
dependencyLicenses {
@@ -105,10 +107,10 @@ boolean s3DisableChunkedEncoding = (new Random(Long.parseUnsignedLong(project.ro
105107
// credentials hard-coded in.
106108

107109
if (!s3PermanentAccessKey && !s3PermanentSecretKey && !s3PermanentBucket && !s3PermanentBasePath) {
108-
s3PermanentAccessKey = 's3_integration_test_permanent_access_key'
109-
s3PermanentSecretKey = 's3_integration_test_permanent_secret_key'
110-
s3PermanentBucket = 'permanent-bucket-test'
111-
s3PermanentBasePath = 'integration_test'
110+
s3PermanentAccessKey = 'access_key'
111+
s3PermanentSecretKey = 'secret_key'
112+
s3PermanentBucket = 'bucket'
113+
s3PermanentBasePath = ''
112114

113115
useFixture = true
114116

@@ -147,25 +149,10 @@ task thirdPartyTest(type: Test) {
147149
if (useFixture) {
148150
apply plugin: 'elasticsearch.test.fixtures'
149151

150-
testFixtures.useFixture()
151-
152-
task writeDockerFile {
153-
File minioDockerfile = new File("${project.buildDir}/minio-docker/Dockerfile")
154-
outputs.file(minioDockerfile)
155-
doLast {
156-
minioDockerfile.parentFile.mkdirs()
157-
minioDockerfile.text = "FROM minio/minio:RELEASE.2019-01-23T23-18-58Z\n" +
158-
"RUN mkdir -p /minio/data/${s3PermanentBucket}\n" +
159-
"ENV MINIO_ACCESS_KEY ${s3PermanentAccessKey}\n" +
160-
"ENV MINIO_SECRET_KEY ${s3PermanentSecretKey}"
161-
}
162-
}
163-
preProcessFixture {
164-
dependsOn(writeDockerFile)
165-
}
152+
testFixtures.useFixture(':test:fixtures:minio-fixture')
166153

167154
def minioAddress = {
168-
int minioPort = postProcessFixture.ext."test.fixtures.minio-fixture.tcp.9000"
155+
int minioPort = project(':test:fixtures:minio-fixture').postProcessFixture.ext."test.fixtures.minio-fixture.tcp.9000"
169156
assert minioPort > 0
170157
'http://127.0.0.1:' + minioPort
171158
}
@@ -178,13 +165,13 @@ if (useFixture) {
178165
}
179166

180167
thirdPartyTest {
181-
dependsOn tasks.bundlePlugin, tasks.postProcessFixture
168+
dependsOn tasks.bundlePlugin
182169
nonInputProperties.systemProperty 'test.s3.endpoint', "${ -> minioAddress.call() }"
183170
}
184171

185172
task integTestMinio(type: RestIntegTestTask) {
186173
description = "Runs REST tests using the Minio repository."
187-
dependsOn tasks.bundlePlugin, tasks.postProcessFixture
174+
dependsOn tasks.bundlePlugin
188175
runner {
189176
// Minio only supports a single access key, see https://github.com/minio/minio/pull/5968
190177
systemProperty 'tests.rest.blacklist', [

settings.gradle

+1
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ List projects = [
5252
'test:fixtures:gcs-fixture',
5353
'test:fixtures:hdfs-fixture',
5454
'test:fixtures:krb5kdc-fixture',
55+
'test:fixtures:minio-fixture',
5556
'test:fixtures:old-elasticsearch',
5657
'test:logger-usage'
5758
]
+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
FROM minio/minio:RELEASE.2019-01-23T23-18-58Z
2+
3+
ARG bucket
4+
ARG accessKey
5+
ARG secretKey
6+
7+
RUN mkdir -p /minio/data/${bucket}
8+
ENV MINIO_ACCESS_KEY=${accessKey}
9+
ENV MINIO_SECRET_KEY=${secretKey}
+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/*
2+
* Licensed to Elasticsearch under one or more contributor
3+
* license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright
5+
* ownership. Elasticsearch licenses this file to you under
6+
* the Apache License, Version 2.0 (the "License"); you may
7+
* not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
apply plugin: 'elasticsearch.build'
20+
apply plugin: 'elasticsearch.test.fixtures'
21+
22+
description = 'Fixture for MinIO Storage service'
23+
test.enabled = false
24+

plugins/repository-s3/docker-compose.yml renamed to test/fixtures/minio-fixture/docker-compose.yml

+5-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,11 @@ version: '3'
22
services:
33
minio-fixture:
44
build:
5-
context: ./build/minio-docker
5+
context: .
6+
args:
7+
bucket: "bucket"
8+
accessKey: "access_key"
9+
secretKey: "secret_key"
610
dockerfile: Dockerfile
711
ports:
812
- "9000"

0 commit comments

Comments
 (0)