2020-04-07 07:28:53 -04:00
|
|
|
import static org.elasticsearch.gradle.PropertyNormalization.IGNORE_VALUE
|
|
|
|
import org.elasticsearch.gradle.info.BuildParams
|
|
|
|
|
|
|
|
apply plugin: 'elasticsearch.standalone-rest-test'
|
|
|
|
apply plugin: 'elasticsearch.rest-test'
|
|
|
|
|
|
|
|
final Project fixture = project(':test:fixtures:s3-fixture')
|
|
|
|
final Project repositoryPlugin = project(':plugins:repository-s3')
|
|
|
|
|
|
|
|
dependencies {
|
2020-06-14 16:30:44 -04:00
|
|
|
testImplementation project(path: xpackModule('searchable-snapshots'), configuration: 'testArtifacts')
|
|
|
|
testImplementation repositoryPlugin
|
2020-04-07 07:28:53 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
restResources {
|
|
|
|
restApi {
|
|
|
|
includeCore 'indices', 'search', 'bulk', 'snapshot', 'nodes', '_common'
|
|
|
|
includeXpack 'searchable_snapshots'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
boolean useFixture = false
|
|
|
|
String s3AccessKey = System.getenv("amazon_s3_access_key")
|
|
|
|
String s3SecretKey = System.getenv("amazon_s3_secret_key")
|
|
|
|
String s3Bucket = System.getenv("amazon_s3_bucket")
|
|
|
|
String s3BasePath = System.getenv("amazon_s3_base_path")
|
|
|
|
|
|
|
|
if (!s3AccessKey && !s3SecretKey && !s3Bucket && !s3BasePath) {
|
|
|
|
s3AccessKey = 'access_key'
|
|
|
|
s3SecretKey = 'secret_key'
|
|
|
|
s3Bucket = 'bucket'
|
2020-06-02 05:26:58 -04:00
|
|
|
s3BasePath = null
|
2020-04-07 07:28:53 -04:00
|
|
|
useFixture = true
|
|
|
|
|
|
|
|
} else if (!s3AccessKey || !s3SecretKey || !s3Bucket || !s3BasePath) {
|
|
|
|
throw new IllegalArgumentException("not all options specified to run against external S3 service are present")
|
|
|
|
}
|
|
|
|
|
|
|
|
if (useFixture) {
|
|
|
|
apply plugin: 'elasticsearch.test.fixtures'
|
|
|
|
testFixtures.useFixture(fixture.path, 's3-fixture-other')
|
|
|
|
}
|
|
|
|
|
|
|
|
integTest {
|
|
|
|
dependsOn repositoryPlugin.bundlePlugin
|
|
|
|
runner {
|
|
|
|
systemProperty 'test.s3.bucket', s3Bucket
|
2020-06-30 04:18:33 -04:00
|
|
|
systemProperty 'test.s3.base_path', s3BasePath ? s3BasePath + "_searchable_snapshots_tests" + BuildParams.testSeed : 'base_path'
|
2020-04-07 07:28:53 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
testClusters.integTest {
|
|
|
|
testDistribution = 'DEFAULT'
|
2020-04-13 11:53:35 -04:00
|
|
|
plugin repositoryPlugin.bundlePlugin.archiveFile
|
2020-04-07 07:28:53 -04:00
|
|
|
|
|
|
|
if (BuildParams.isSnapshotBuild() == false) {
|
|
|
|
systemProperty 'es.searchable_snapshots_feature_enabled', 'true'
|
|
|
|
}
|
|
|
|
|
|
|
|
keystore 's3.client.searchable_snapshots.access_key', s3AccessKey
|
|
|
|
keystore 's3.client.searchable_snapshots.secret_key', s3SecretKey
|
|
|
|
setting 'xpack.license.self_generated.type', 'trial'
|
|
|
|
|
|
|
|
if (useFixture) {
|
|
|
|
def fixtureAddress = { fixtureName ->
|
|
|
|
assert useFixture: 'closure should not be used without a fixture'
|
|
|
|
int ephemeralPort = fixture.postProcessFixture.ext."test.fixtures.${fixtureName}.tcp.80"
|
|
|
|
assert ephemeralPort > 0
|
|
|
|
'127.0.0.1:' + ephemeralPort
|
|
|
|
}
|
|
|
|
setting 's3.client.searchable_snapshots.protocol', 'http'
|
|
|
|
setting 's3.client.searchable_snapshots.endpoint', { "${-> fixtureAddress('s3-fixture-other')}" }, IGNORE_VALUE
|
|
|
|
|
|
|
|
} else {
|
|
|
|
println "Using an external service to test " + project.name
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-06-02 05:26:58 -04:00
|
|
|
task s3ThirdPartyTest {
|
|
|
|
dependsOn integTest
|
|
|
|
}
|