Move MinIO fixture in its own project (#49036)

This commit moves the MinIO docker-compose fixture from the
:plugins:repository-s3 to its own :test:minio-fixture Gradle project.
This commit is contained in:
Tanguy Leroux 2019-11-13 10:03:59 -05:00 committed by GitHub
parent 838af15d29
commit 20fc1dbe18
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 49 additions and 24 deletions

View File

@ -51,6 +51,8 @@ dependencies {
// HACK: javax.xml.bind was removed from default modules in java 9, so we pull the api in here, // HACK: javax.xml.bind was removed from default modules in java 9, so we pull the api in here,
// and whitelist this hack in JarHell // and whitelist this hack in JarHell
compile 'javax.xml.bind:jaxb-api:2.2.2' compile 'javax.xml.bind:jaxb-api:2.2.2'
testCompile project(':test:fixtures:minio-fixture')
} }
dependencyLicenses { dependencyLicenses {
@ -106,10 +108,10 @@ boolean s3DisableChunkedEncoding = (new Random(Long.parseUnsignedLong(BuildParam
// credentials hard-coded in. // credentials hard-coded in.
if (!s3PermanentAccessKey && !s3PermanentSecretKey && !s3PermanentBucket && !s3PermanentBasePath) { if (!s3PermanentAccessKey && !s3PermanentSecretKey && !s3PermanentBucket && !s3PermanentBasePath) {
s3PermanentAccessKey = 's3_integration_test_permanent_access_key' s3PermanentAccessKey = 'access_key'
s3PermanentSecretKey = 's3_integration_test_permanent_secret_key' s3PermanentSecretKey = 'secret_key'
s3PermanentBucket = 'permanent-bucket-test' s3PermanentBucket = 'bucket'
s3PermanentBasePath = 'integration_test' s3PermanentBasePath = ''
useFixture = true useFixture = true
@ -148,25 +150,10 @@ task thirdPartyTest(type: Test) {
if (useFixture) { if (useFixture) {
apply plugin: 'elasticsearch.test.fixtures' apply plugin: 'elasticsearch.test.fixtures'
testFixtures.useFixture() testFixtures.useFixture(':test:fixtures:minio-fixture')
task writeDockerFile {
File minioDockerfile = new File("${project.buildDir}/minio-docker/Dockerfile")
outputs.file(minioDockerfile)
doLast {
minioDockerfile.parentFile.mkdirs()
minioDockerfile.text = "FROM minio/minio:RELEASE.2019-01-23T23-18-58Z\n" +
"RUN mkdir -p /minio/data/${s3PermanentBucket}\n" +
"ENV MINIO_ACCESS_KEY ${s3PermanentAccessKey}\n" +
"ENV MINIO_SECRET_KEY ${s3PermanentSecretKey}"
}
}
preProcessFixture {
dependsOn(writeDockerFile)
}
def minioAddress = { def minioAddress = {
int minioPort = postProcessFixture.ext."test.fixtures.minio-fixture.tcp.9000" int minioPort = project(':test:fixtures:minio-fixture').postProcessFixture.ext."test.fixtures.minio-fixture.tcp.9000"
assert minioPort > 0 assert minioPort > 0
'http://127.0.0.1:' + minioPort 'http://127.0.0.1:' + minioPort
} }
@ -179,13 +166,13 @@ if (useFixture) {
} }
thirdPartyTest { thirdPartyTest {
dependsOn tasks.bundlePlugin, tasks.postProcessFixture dependsOn tasks.bundlePlugin
nonInputProperties.systemProperty 'test.s3.endpoint', "${ -> minioAddress.call() }" nonInputProperties.systemProperty 'test.s3.endpoint', "${ -> minioAddress.call() }"
} }
task integTestMinio(type: RestIntegTestTask) { task integTestMinio(type: RestIntegTestTask) {
description = "Runs REST tests using the Minio repository." description = "Runs REST tests using the Minio repository."
dependsOn tasks.bundlePlugin, tasks.postProcessFixture dependsOn tasks.bundlePlugin
runner { runner {
// Minio only supports a single access key, see https://github.com/minio/minio/pull/5968 // Minio only supports a single access key, see https://github.com/minio/minio/pull/5968
systemProperty 'tests.rest.blacklist', [ systemProperty 'tests.rest.blacklist', [

View File

@ -56,6 +56,7 @@ List projects = [
'test:fixtures:gcs-fixture', 'test:fixtures:gcs-fixture',
'test:fixtures:hdfs-fixture', 'test:fixtures:hdfs-fixture',
'test:fixtures:krb5kdc-fixture', 'test:fixtures:krb5kdc-fixture',
'test:fixtures:minio-fixture',
'test:fixtures:old-elasticsearch', 'test:fixtures:old-elasticsearch',
'test:logger-usage' 'test:logger-usage'
] ]

View File

@ -0,0 +1,9 @@
FROM minio/minio:RELEASE.2019-01-23T23-18-58Z
ARG bucket
ARG accessKey
ARG secretKey
RUN mkdir -p /minio/data/${bucket}
ENV MINIO_ACCESS_KEY=${accessKey}
ENV MINIO_SECRET_KEY=${secretKey}

View File

@ -0,0 +1,24 @@
/*
* Licensed to Elasticsearch under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
apply plugin: 'elasticsearch.build'
apply plugin: 'elasticsearch.test.fixtures'
description = 'Fixture for MinIO Storage service'
test.enabled = false

View File

@ -2,7 +2,11 @@ version: '3'
services: services:
minio-fixture: minio-fixture:
build: build:
context: ./build/minio-docker context: .
args:
bucket: "bucket"
accessKey: "access_key"
secretKey: "secret_key"
dockerfile: Dockerfile dockerfile: Dockerfile
ports: ports:
- "9000" - "9000"