63 lines
2.3 KiB
Groovy
63 lines
2.3 KiB
Groovy
/*
|
|
* 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 {
|
|
api project(":plugins:repository-s3")
|
|
testImplementation project(":test:framework")
|
|
testImplementation project(':x-pack:snapshot-tool')
|
|
testImplementation files(project(':x-pack:snapshot-tool').sourceSets.test.output)
|
|
}
|
|
|
|
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) {
|
|
s3PermanentAccessKey = 'sn_tool_access_key'
|
|
s3PermanentSecretKey = 'sn_tool_secret_key'
|
|
s3PermanentBucket = 'bucket'
|
|
s3PermanentBasePath = 'integration_test'
|
|
|
|
useS3Fixture = true
|
|
} else if (!s3PermanentAccessKey || !s3PermanentSecretKey || !s3PermanentBucket || !s3PermanentBasePath) {
|
|
throw new IllegalArgumentException("not all options specified to run against external S3 service as permanent credentials are present")
|
|
}
|
|
|
|
task s3ThirdPartyTest(type: Test) {
|
|
include '**/*.class'
|
|
|
|
systemProperty 'tests.security.manager', false
|
|
|
|
systemProperty 'test.s3.account', s3PermanentAccessKey
|
|
systemProperty 'test.s3.key', s3PermanentSecretKey
|
|
systemProperty 'test.s3.bucket', s3PermanentBucket
|
|
systemProperty 'test.s3.base', s3PermanentBasePath
|
|
}
|
|
|
|
if (useS3Fixture) {
|
|
apply plugin: 'elasticsearch.test.fixtures'
|
|
testingConventions.enabled = false;
|
|
testFixtures.useFixture(':test:fixtures:minio-fixture', "minio-fixture-for-snapshot-tool")
|
|
|
|
def minioAddress = {
|
|
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
|
|
}
|
|
|
|
s3ThirdPartyTest {
|
|
dependsOn project(':test:fixtures:minio-fixture').postProcessFixture
|
|
nonInputProperties.systemProperty 'test.s3.endpoint', "${-> minioAddress.call()}"
|
|
}
|
|
}
|
|
check.dependsOn(s3ThirdPartyTest)
|