2020-06-02 05:26:58 -04:00
|
|
|
import org.elasticsearch.gradle.MavenFilteringHack
|
2019-11-01 14:33:11 -04:00
|
|
|
import org.elasticsearch.gradle.info.BuildParams
|
|
|
|
|
2020-06-02 05:26:58 -04:00
|
|
|
import static org.elasticsearch.gradle.PropertyNormalization.DEFAULT
|
|
|
|
import static org.elasticsearch.gradle.PropertyNormalization.IGNORE_VALUE
|
|
|
|
|
2015-10-29 14:40:19 -04:00
|
|
|
/*
|
|
|
|
* Licensed to Elasticsearch under one or more contributor
|
|
|
|
* license agreements. See the NOTICE file distributed with
|
|
|
|
* this work for additional information regarding copyright
|
|
|
|
* ownership. Elasticsearch licenses this file to you under
|
|
|
|
* the Apache License, Version 2.0 (the "License"); you may
|
|
|
|
* not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing,
|
|
|
|
* software distributed under the License is distributed on an
|
|
|
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
|
|
* KIND, either express or implied. See the License for the
|
|
|
|
* specific language governing permissions and limitations
|
|
|
|
* under the License.
|
|
|
|
*/
|
2020-07-06 15:16:26 -04:00
|
|
|
apply plugin: 'elasticsearch.rest-resources'
|
2015-10-29 14:40:19 -04:00
|
|
|
|
|
|
|
esplugin {
|
|
|
|
description 'The Azure Repository plugin adds support for Azure storage repositories.'
|
2017-09-14 05:56:02 -04:00
|
|
|
classname 'org.elasticsearch.repositories.azure.AzureRepositoryPlugin'
|
2015-10-29 14:40:19 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
dependencies {
|
2020-06-30 09:57:41 -04:00
|
|
|
api 'com.microsoft.azure:azure-storage:8.6.2'
|
|
|
|
api 'com.microsoft.azure:azure-keyvault-core:1.0.0'
|
2020-04-08 02:20:17 -04:00
|
|
|
runtimeOnly 'com.google.guava:guava:20.0'
|
2020-06-30 09:57:41 -04:00
|
|
|
api 'org.apache.commons:commons-lang3:3.4'
|
2020-06-14 16:30:44 -04:00
|
|
|
testImplementation project(':test:fixtures:azure-fixture')
|
2015-10-29 14:40:19 -04:00
|
|
|
}
|
|
|
|
|
2020-03-19 13:28:59 -04:00
|
|
|
restResources {
|
|
|
|
restApi {
|
2020-06-02 05:26:58 -04:00
|
|
|
includeCore '_common', 'cluster', 'nodes', 'snapshot', 'bulk', 'count', 'indices'
|
2020-03-19 13:28:59 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-06-18 02:15:50 -04:00
|
|
|
tasks.named("dependencyLicenses").configure {
|
2015-10-29 14:40:19 -04:00
|
|
|
mapping from: /azure-.*/, to: 'azure'
|
|
|
|
mapping from: /jackson-.*/, to: 'jackson'
|
|
|
|
mapping from: /jersey-.*/, to: 'jersey'
|
|
|
|
mapping from: /jaxb-.*/, to: 'jaxb'
|
|
|
|
mapping from: /stax-.*/, to: 'stax'
|
|
|
|
}
|
|
|
|
|
2019-01-07 10:24:19 -05:00
|
|
|
thirdPartyAudit {
|
2019-11-14 06:01:23 -05:00
|
|
|
ignoreMissingClasses(
|
|
|
|
// Optional and not enabled by Elasticsearch
|
|
|
|
'org.slf4j.Logger',
|
|
|
|
'org.slf4j.LoggerFactory'
|
|
|
|
)
|
2019-01-07 10:24:19 -05:00
|
|
|
|
2019-11-14 06:01:23 -05:00
|
|
|
ignoreViolations(
|
|
|
|
// uses internal java api: sun.misc.Unsafe
|
|
|
|
'com.google.common.cache.Striped64',
|
|
|
|
'com.google.common.cache.Striped64$1',
|
|
|
|
'com.google.common.cache.Striped64$Cell',
|
|
|
|
'com.google.common.hash.LittleEndianByteArray$UnsafeByteArray$1',
|
|
|
|
'com.google.common.hash.LittleEndianByteArray$UnsafeByteArray$2',
|
|
|
|
'com.google.common.hash.LittleEndianByteArray$UnsafeByteArray$3',
|
|
|
|
'com.google.common.util.concurrent.AbstractFuture$UnsafeAtomicHelper',
|
|
|
|
'com.google.common.util.concurrent.AbstractFuture$UnsafeAtomicHelper$1',
|
|
|
|
'com.google.common.hash.LittleEndianByteArray$UnsafeByteArray',
|
|
|
|
'com.google.common.primitives.UnsignedBytes$LexicographicalComparatorHolder$UnsafeComparator',
|
|
|
|
'com.google.common.primitives.UnsignedBytes$LexicographicalComparatorHolder$UnsafeComparator$1'
|
|
|
|
)
|
2019-01-07 10:24:19 -05:00
|
|
|
}
|
2016-06-27 06:04:59 -04:00
|
|
|
|
2020-06-02 05:26:58 -04:00
|
|
|
boolean useFixture = false
|
2018-04-06 05:06:20 -04:00
|
|
|
|
2020-06-02 05:26:58 -04:00
|
|
|
def azureAddress = {
|
|
|
|
assert useFixture: 'closure should not be used without a fixture'
|
|
|
|
int ephemeralPort = project(':test:fixtures:azure-fixture').postProcessFixture.ext."test.fixtures.azure-fixture.tcp.8091"
|
|
|
|
assert ephemeralPort > 0
|
|
|
|
return 'ignored;DefaultEndpointsProtocol=http;BlobEndpoint=http://127.0.0.1:' + ephemeralPort + '/'
|
2018-05-02 03:16:51 -04:00
|
|
|
}
|
2019-05-28 04:46:22 -04:00
|
|
|
|
|
|
|
String azureAccount = System.getenv("azure_storage_account")
|
|
|
|
String azureKey = System.getenv("azure_storage_key")
|
|
|
|
String azureContainer = System.getenv("azure_storage_container")
|
|
|
|
String azureBasePath = System.getenv("azure_storage_base_path")
|
2019-06-26 07:43:32 -04:00
|
|
|
String azureSasToken = System.getenv("azure_storage_sas_token")
|
2019-05-28 04:46:22 -04:00
|
|
|
|
2020-06-02 05:26:58 -04:00
|
|
|
if (!azureAccount && !azureKey && !azureContainer && !azureBasePath && !azureSasToken) {
|
|
|
|
azureAccount = 'azure_integration_test_account'
|
|
|
|
azureKey = 'YXp1cmVfaW50ZWdyYXRpb25fdGVzdF9rZXk=' // The key is "azure_integration_test_key" encoded using base64
|
|
|
|
azureContainer = 'container'
|
|
|
|
azureBasePath = ''
|
|
|
|
azureSasToken = ''
|
|
|
|
useFixture = true
|
|
|
|
|
|
|
|
apply plugin: 'elasticsearch.test.fixtures'
|
|
|
|
testFixtures.useFixture ':test:fixtures:azure-fixture', 'azure-fixture'
|
|
|
|
}
|
|
|
|
|
|
|
|
Map<String, Object> expansions = [
|
|
|
|
'container': azureContainer,
|
|
|
|
'base_path': azureBasePath + "_integration_tests"
|
|
|
|
]
|
|
|
|
|
|
|
|
processTestResources {
|
|
|
|
inputs.properties(expansions)
|
|
|
|
MavenFilteringHack.filter(it, expansions)
|
|
|
|
}
|
|
|
|
|
2019-05-28 04:46:22 -04:00
|
|
|
test {
|
2020-06-02 05:26:58 -04:00
|
|
|
// this is tested explicitly in a separate test task
|
2019-05-28 04:46:22 -04:00
|
|
|
exclude '**/AzureStorageCleanupThirdPartyTests.class'
|
|
|
|
}
|
|
|
|
|
2020-06-02 05:26:58 -04:00
|
|
|
testClusters {
|
|
|
|
integTest {
|
|
|
|
keystore 'azure.client.integration_test.account', azureAccount
|
|
|
|
if (azureKey != null && azureKey.isEmpty() == false) {
|
|
|
|
keystore 'azure.client.integration_test.key', azureKey
|
|
|
|
}
|
|
|
|
if (azureSasToken != null && azureSasToken.isEmpty() == false) {
|
|
|
|
keystore 'azure.client.integration_test.sas_token', azureSasToken
|
|
|
|
}
|
|
|
|
if (useFixture) {
|
|
|
|
setting 'azure.client.integration_test.endpoint_suffix', azureAddress
|
|
|
|
String firstPartOfSeed = BuildParams.testSeed.tokenize(':').get(0)
|
|
|
|
setting 'thread_pool.repository_azure.max', (Math.abs(Long.parseUnsignedLong(firstPartOfSeed, 16) % 10) + 1).toString(), System.getProperty('ignore.tests.seed') == null ? DEFAULT : IGNORE_VALUE
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
task azureThirdPartyTest(type: Test) {
|
|
|
|
dependsOn tasks.integTest
|
2019-05-28 04:46:22 -04:00
|
|
|
include '**/AzureStorageCleanupThirdPartyTests.class'
|
|
|
|
systemProperty 'test.azure.account', azureAccount ? azureAccount : ""
|
|
|
|
systemProperty 'test.azure.key', azureKey ? azureKey : ""
|
2019-06-26 07:43:32 -04:00
|
|
|
systemProperty 'test.azure.sas_token', azureSasToken ? azureSasToken : ""
|
2019-05-28 04:46:22 -04:00
|
|
|
systemProperty 'test.azure.container', azureContainer ? azureContainer : ""
|
2019-11-01 14:33:11 -04:00
|
|
|
systemProperty 'test.azure.base', (azureBasePath ? azureBasePath : "") + "_third_party_tests_" + BuildParams.testSeed
|
2020-06-02 05:26:58 -04:00
|
|
|
if (useFixture) {
|
|
|
|
nonInputProperties.systemProperty 'test.azure.endpoint_suffix', "${-> azureAddress.call() }"
|
|
|
|
}
|
2019-05-28 04:46:22 -04:00
|
|
|
}
|
2020-06-02 05:26:58 -04:00
|
|
|
check.dependsOn(azureThirdPartyTest)
|