Skip to content

Commit 899dfc3

Browse files
Fix S3 Repository ITs When Docker is not Available (elastic#37878)
* Disable Minio fixture and tests that require it when fixtures are disabled or Docker is not available * Relates elastic#37852
1 parent 980c13d commit 899dfc3

File tree

1 file changed

+26
-22
lines changed

1 file changed

+26
-22
lines changed

plugins/repository-s3/build.gradle

Lines changed: 26 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -170,28 +170,33 @@ if (useFixture) {
170170
preProcessFixture.dependsOn(writeDockerFile)
171171
// The following closure must execute before the afterEvaluate block in the constructor of the following integrationTest tasks:
172172
project.afterEvaluate {
173-
ClusterConfiguration cluster = project.extensions.getByName('integTestMinioCluster') as ClusterConfiguration
174-
cluster.dependsOn(project.bundlePlugin)
175-
cluster.dependsOn(postProcessFixture)
176-
cluster.keystoreSetting 's3.client.integration_test_permanent.access_key', s3PermanentAccessKey
177-
cluster.keystoreSetting 's3.client.integration_test_permanent.secret_key', s3PermanentSecretKey
178-
179-
Closure<String> minioAddressAndPort = {
180-
int minioPort = postProcessFixture.ext."test.fixtures.minio-fixture.tcp.9000"
181-
assert minioPort > 0
182-
return 'http://127.0.0.1:' + minioPort
173+
// Only configure the Minio tests if postProcessFixture is configured to skip them if Docker is not available
174+
// or fixtures have been disabled
175+
if (postProcessFixture.enabled) {
176+
ClusterConfiguration cluster = project.extensions.getByName('integTestMinioCluster') as ClusterConfiguration
177+
cluster.dependsOn(project.bundlePlugin)
178+
cluster.dependsOn(postProcessFixture)
179+
cluster.keystoreSetting 's3.client.integration_test_permanent.access_key', s3PermanentAccessKey
180+
cluster.keystoreSetting 's3.client.integration_test_permanent.secret_key', s3PermanentSecretKey
181+
182+
Closure<String> minioAddressAndPort = {
183+
int minioPort = postProcessFixture.ext."test.fixtures.minio-fixture.tcp.9000"
184+
assert minioPort > 0
185+
return 'http://127.0.0.1:' + minioPort
186+
}
187+
cluster.setting 's3.client.integration_test_permanent.endpoint', "${-> minioAddressAndPort.call()}"
188+
189+
Task restIntegTestTask = project.tasks.getByName('integTestMinio')
190+
restIntegTestTask.clusterConfig.plugin(project.path)
191+
192+
// Default jvm arguments for all test clusters
193+
String jvmArgs = "-Xms" + System.getProperty('tests.heap.size', '512m') +
194+
" " + "-Xmx" + System.getProperty('tests.heap.size', '512m') +
195+
" " + System.getProperty('tests.jvm.argline', '')
196+
197+
restIntegTestTask.clusterConfig.jvmArgs = jvmArgs
198+
project.check.dependsOn(integTestMinio)
183199
}
184-
cluster.setting 's3.client.integration_test_permanent.endpoint', "${ -> minioAddressAndPort.call()}"
185-
186-
Task restIntegTestTask = project.tasks.getByName('integTestMinio')
187-
restIntegTestTask.clusterConfig.plugin(project.path)
188-
189-
// Default jvm arguments for all test clusters
190-
String jvmArgs = "-Xms" + System.getProperty('tests.heap.size', '512m') +
191-
" " + "-Xmx" + System.getProperty('tests.heap.size', '512m') +
192-
" " + System.getProperty('tests.jvm.argline', '')
193-
194-
restIntegTestTask.clusterConfig.jvmArgs = jvmArgs
195200
}
196201

197202
integTestMinioRunner.dependsOn(postProcessFixture)
@@ -202,7 +207,6 @@ if (useFixture) {
202207
'repository_s3/50_repository_ecs_credentials/*'
203208
].join(",")
204209

205-
project.check.dependsOn(integTestMinio)
206210
BuildPlugin.requireDocker(integTestMinio)
207211
}
208212

0 commit comments

Comments
 (0)