Skip to content

Commit 32e89b1

Browse files
committed
Fold amazon-s3 into super project
1 parent 8fa0629 commit 32e89b1

File tree

6 files changed

+44
-120
lines changed

6 files changed

+44
-120
lines changed

plugins/repository-s3/build.gradle

Lines changed: 44 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
import org.elasticsearch.gradle.MavenFilteringHack
2+
import org.elasticsearch.gradle.test.AntFixture
3+
14
/*
25
* Licensed to Elasticsearch under one or more contributor
36
* license agreements. See the NOTICE file distributed with
@@ -64,14 +67,50 @@ test {
6467
exclude '**/*CredentialsTests.class'
6568
}
6669

67-
check {
68-
// also execute the QA tests when testing the plugin
69-
dependsOn 'qa:amazon-s3:check'
70+
boolean useFixture = false
71+
72+
String s3AccessKey = System.getenv("amazon_s3_access_key")
73+
String s3SecretKey = System.getenv("amazon_s3_secret_key")
74+
String s3Bucket = System.getenv("amazon_s3_bucket")
75+
String s3BasePath = System.getenv("amazon_s3_base_path")
76+
77+
if (!s3AccessKey && !s3SecretKey && !s3Bucket && !s3BasePath) {
78+
s3AccessKey = 's3_integration_test_access_key'
79+
s3SecretKey = 's3_integration_test_secret_key'
80+
s3Bucket = 'bucket_test'
81+
s3BasePath = 'integration_test'
82+
useFixture = true
83+
}
84+
85+
/** A task to start the AmazonS3Fixture which emulates an S3 service **/
86+
task s3Fixture(type: AntFixture) {
87+
dependsOn testClasses
88+
env 'CLASSPATH', "${ -> project.sourceSets.test.runtimeClasspath.asPath }"
89+
executable = new File(project.runtimeJavaHome, 'bin/java')
90+
args 'org.elasticsearch.repositories.s3.AmazonS3Fixture', baseDir, s3Bucket
91+
}
92+
93+
Map<String, Object> expansions = [
94+
'bucket': s3Bucket,
95+
'base_path': s3BasePath
96+
]
97+
98+
processTestResources {
99+
inputs.properties(expansions)
100+
MavenFilteringHack.filter(it, expansions)
70101
}
71102

72103
integTestCluster {
73-
keystoreSetting 's3.client.integration_test.access_key', "s3_integration_test_access_key"
74-
keystoreSetting 's3.client.integration_test.secret_key', "s3_integration_test_secret_key"
104+
keystoreSetting 's3.client.integration_test.access_key', s3AccessKey
105+
keystoreSetting 's3.client.integration_test.secret_key', s3SecretKey
106+
107+
if (useFixture) {
108+
dependsOn s3Fixture
109+
/* Use a closure on the string to delay evaluation until tests are executed */
110+
setting 's3.client.integration_test.endpoint', "http://${-> s3Fixture.addressAndPort}"
111+
} else {
112+
println "Using an external service to test the repository-s3 plugin"
113+
}
75114
}
76115

77116
thirdPartyAudit.excludes = [

plugins/repository-s3/qa/amazon-s3/build.gradle

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

plugins/repository-s3/qa/amazon-s3/src/test/java/org/elasticsearch/repositories/s3/AmazonS3RepositoryClientYamlTestSuiteIT.java

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

plugins/repository-s3/qa/build.gradle

Whitespace-only changes.

0 commit comments

Comments
 (0)