2019-10-31 11:21:36 -04:00
|
|
|
/*
|
|
|
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
|
|
* or more contributor license agreements. Licensed under the Elastic License;
|
|
|
|
* you may not use this file except in compliance with the Elastic License.
|
|
|
|
*/
|
|
|
|
apply plugin: 'elasticsearch.build'
|
|
|
|
|
|
|
|
dependencies {
|
2020-06-30 09:57:41 -04:00
|
|
|
api project(":plugins:repository-s3")
|
2020-06-14 16:30:44 -04:00
|
|
|
testImplementation project(":test:framework")
|
|
|
|
testImplementation project(':x-pack:snapshot-tool')
|
|
|
|
testImplementation files(project(':x-pack:snapshot-tool').sourceSets.test.output)
|
2019-10-31 11:21:36 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
test.enabled = false
|
|
|
|
|
|
|
|
boolean useS3Fixture = false
|
|
|
|
|
|
|
|
String s3PermanentAccessKey = System.getenv("amazon_s3_access_key")
|
|
|
|
String s3PermanentSecretKey = System.getenv("amazon_s3_secret_key")
|
|
|
|
String s3PermanentBucket = System.getenv("amazon_s3_bucket")
|
|
|
|
String s3PermanentBasePath = System.getenv("amazon_s3_base_path")
|
|
|
|
|
|
|
|
if (!s3PermanentAccessKey && !s3PermanentSecretKey && !s3PermanentBucket && !s3PermanentBasePath) {
|
2020-01-08 10:33:36 -05:00
|
|
|
s3PermanentAccessKey = 'sn_tool_access_key'
|
|
|
|
s3PermanentSecretKey = 'sn_tool_secret_key'
|
|
|
|
s3PermanentBucket = 'bucket'
|
2019-11-14 06:01:23 -05:00
|
|
|
s3PermanentBasePath = 'integration_test'
|
2019-10-31 11:21:36 -04:00
|
|
|
|
2019-11-14 06:01:23 -05:00
|
|
|
useS3Fixture = true
|
2019-10-31 11:21:36 -04:00
|
|
|
} else if (!s3PermanentAccessKey || !s3PermanentSecretKey || !s3PermanentBucket || !s3PermanentBasePath) {
|
2019-11-14 06:01:23 -05:00
|
|
|
throw new IllegalArgumentException("not all options specified to run against external S3 service as permanent credentials are present")
|
2019-10-31 11:21:36 -04:00
|
|
|
}
|
|
|
|
|
2020-06-02 05:26:58 -04:00
|
|
|
task s3ThirdPartyTest(type: Test) {
|
2019-11-14 06:01:23 -05:00
|
|
|
include '**/*.class'
|
2019-10-31 11:21:36 -04:00
|
|
|
|
2019-11-14 06:01:23 -05:00
|
|
|
systemProperty 'tests.security.manager', false
|
2019-10-31 11:21:36 -04:00
|
|
|
|
2019-11-14 06:01:23 -05:00
|
|
|
systemProperty 'test.s3.account', s3PermanentAccessKey
|
|
|
|
systemProperty 'test.s3.key', s3PermanentSecretKey
|
|
|
|
systemProperty 'test.s3.bucket', s3PermanentBucket
|
|
|
|
systemProperty 'test.s3.base', s3PermanentBasePath
|
2019-10-31 11:21:36 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
if (useS3Fixture) {
|
2020-01-14 11:46:47 -05:00
|
|
|
apply plugin: 'elasticsearch.test.fixtures'
|
2019-11-14 06:01:23 -05:00
|
|
|
testingConventions.enabled = false;
|
2020-01-08 10:33:36 -05:00
|
|
|
testFixtures.useFixture(':test:fixtures:minio-fixture', "minio-fixture-for-snapshot-tool")
|
2019-11-14 06:01:23 -05:00
|
|
|
|
|
|
|
def minioAddress = {
|
2020-01-08 10:33:36 -05:00
|
|
|
int minioPort = project(':test:fixtures:minio-fixture').postProcessFixture.ext."test.fixtures.minio-fixture-for-snapshot-tool.tcp.9000"
|
|
|
|
assert minioPort > 0
|
|
|
|
'http://127.0.0.1:' + minioPort
|
2019-11-14 06:01:23 -05:00
|
|
|
}
|
|
|
|
|
2020-06-02 05:26:58 -04:00
|
|
|
s3ThirdPartyTest {
|
2020-01-08 10:33:36 -05:00
|
|
|
dependsOn project(':test:fixtures:minio-fixture').postProcessFixture
|
|
|
|
nonInputProperties.systemProperty 'test.s3.endpoint', "${-> minioAddress.call()}"
|
2019-11-14 06:01:23 -05:00
|
|
|
}
|
2019-10-31 11:21:36 -04:00
|
|
|
}
|
2020-06-02 05:26:58 -04:00
|
|
|
check.dependsOn(s3ThirdPartyTest)
|