2018-05-02 03:16:51 -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.
|
|
|
|
*/
|
|
|
|
|
2019-07-10 18:42:28 -04:00
|
|
|
|
2018-05-02 03:16:51 -04:00
|
|
|
import org.elasticsearch.gradle.MavenFilteringHack
|
2019-11-01 14:33:11 -04:00
|
|
|
import org.elasticsearch.gradle.info.BuildParams
|
2018-05-02 03:16:51 -04:00
|
|
|
import org.elasticsearch.gradle.test.AntFixture
|
|
|
|
|
2019-07-10 18:42:28 -04:00
|
|
|
import static org.elasticsearch.gradle.PropertyNormalization.DEFAULT
|
|
|
|
import static org.elasticsearch.gradle.PropertyNormalization.IGNORE_VALUE
|
|
|
|
|
2018-05-02 03:16:51 -04:00
|
|
|
apply plugin: 'elasticsearch.standalone-rest-test'
|
|
|
|
apply plugin: 'elasticsearch.rest-test'
|
2019-10-31 05:43:43 -04:00
|
|
|
apply plugin: 'elasticsearch.test.fixtures'
|
|
|
|
|
2020-03-19 13:28:59 -04:00
|
|
|
restResources {
|
|
|
|
restApi {
|
|
|
|
includeCore '_common', 'snapshot', 'bulk', 'count', 'indices'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-10-31 05:43:43 -04:00
|
|
|
testFixtures.useFixture ":test:fixtures:azure-fixture", "azure-fixture"
|
2018-05-02 03:16:51 -04:00
|
|
|
|
|
|
|
boolean useFixture = false
|
|
|
|
|
|
|
|
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")
|
2018-05-02 03:16:51 -04:00
|
|
|
|
2019-06-26 07:43:32 -04:00
|
|
|
if (!azureAccount && !azureKey && !azureContainer && !azureBasePath && !azureSasToken) {
|
2019-11-14 06:01:23 -05:00
|
|
|
azureAccount = 'azure_integration_test_account'
|
|
|
|
azureKey = 'YXp1cmVfaW50ZWdyYXRpb25fdGVzdF9rZXk=' // The key is "azure_integration_test_key" encoded using base64
|
|
|
|
azureContainer = 'container'
|
|
|
|
azureBasePath = ''
|
|
|
|
azureSasToken = ''
|
|
|
|
useFixture = true
|
2018-05-02 03:16:51 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
Map<String, Object> expansions = [
|
2019-11-14 06:01:23 -05:00
|
|
|
'container': azureContainer,
|
|
|
|
'base_path': azureBasePath + "_integration_tests"
|
2018-05-02 03:16:51 -04:00
|
|
|
]
|
2018-06-14 08:09:56 -04:00
|
|
|
|
2018-05-02 03:16:51 -04:00
|
|
|
processTestResources {
|
2019-11-14 06:01:23 -05:00
|
|
|
inputs.properties(expansions)
|
|
|
|
MavenFilteringHack.filter(it, expansions)
|
2018-05-02 03:16:51 -04:00
|
|
|
}
|
|
|
|
|
2019-04-26 11:34:03 -04:00
|
|
|
integTest {
|
2019-11-14 06:01:23 -05:00
|
|
|
dependsOn project(':plugins:repository-azure').bundlePlugin
|
|
|
|
}
|
2019-04-26 11:34:03 -04:00
|
|
|
|
|
|
|
testClusters.integTest {
|
2020-04-13 11:53:35 -04:00
|
|
|
plugin project(':plugins:repository-azure').bundlePlugin.archiveFile
|
2019-11-14 06:01:23 -05:00
|
|
|
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
|
|
|
|
}
|
2018-05-02 03:16:51 -04:00
|
|
|
|
2019-11-14 06:01:23 -05:00
|
|
|
if (useFixture) {
|
|
|
|
def azureAddress = {
|
|
|
|
int ephemeralPort = project(':test:fixtures:azure-fixture').postProcessFixture.ext."test.fixtures.azure-fixture.tcp.8091"
|
|
|
|
assert ephemeralPort > 0
|
|
|
|
'http://127.0.0.1:' + ephemeralPort
|
2018-05-02 03:16:51 -04:00
|
|
|
}
|
2019-11-14 06:01:23 -05:00
|
|
|
// Use a closure on the string to delay evaluation until tests are executed. The endpoint_suffix is used
|
|
|
|
// in a hacky way to change the protocol and endpoint. We must fix that.
|
|
|
|
setting 'azure.client.integration_test.endpoint_suffix',
|
|
|
|
{ "ignored;DefaultEndpointsProtocol=http;BlobEndpoint=${-> azureAddress()}" }, IGNORE_VALUE
|
2020-03-25 07:13:25 -04:00
|
|
|
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
|
2019-11-14 06:01:23 -05:00
|
|
|
}
|
2018-05-02 03:16:51 -04:00
|
|
|
}
|