OpenSearch/x-pack/plugin/searchable-snapshots/qa/azure/build.gradle

83 lines
2.8 KiB
Groovy

import org.elasticsearch.gradle.info.BuildParams
import static org.elasticsearch.gradle.PropertyNormalization.IGNORE_VALUE
apply plugin: 'elasticsearch.standalone-rest-test'
apply plugin: 'elasticsearch.rest-test'
apply plugin: 'elasticsearch.rest-resources'
final Project fixture = project(':test:fixtures:azure-fixture')
final Project repositoryPlugin = project(':plugins:repository-azure')
dependencies {
testImplementation project(path: xpackModule('searchable-snapshots'), configuration: 'testArtifacts')
testImplementation repositoryPlugin
}
restResources {
restApi {
includeCore 'indices', 'search', 'bulk', 'snapshot', 'nodes', '_common'
includeXpack 'searchable_snapshots'
}
}
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")
String azureSasToken = System.getenv("azure_storage_sas_token")
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
}
if (useFixture) {
apply plugin: 'elasticsearch.test.fixtures'
testFixtures.useFixture(fixture.path, 'azure-fixture-other')
}
integTest {
systemProperty 'test.azure.container', azureContainer
nonInputProperties.systemProperty 'test.azure.base_path', azureBasePath + "_searchable_snapshots_tests_" + BuildParams.testSeed
}
testClusters.integTest {
testDistribution = 'DEFAULT'
plugin repositoryPlugin.path
keystore 'azure.client.searchable_snapshots.account', azureAccount
if (azureKey != null && azureKey.isEmpty() == false) {
keystore 'azure.client.searchable_snapshots.key', azureKey
}
if (azureSasToken != null && azureSasToken.isEmpty() == false) {
keystore 'azure.client.searchable_snapshots.sas_token', azureSasToken
}
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.8091"
assert ephemeralPort > 0
'127.0.0.1:' + ephemeralPort
}
setting 'azure.client.searchable_snapshots.endpoint_suffix',
{ "ignored;DefaultEndpointsProtocol=http;BlobEndpoint=http://${-> fixtureAddress('azure-fixture-other')}" }, IGNORE_VALUE
} else {
println "Using an external service to test " + project.name
}
}
tasks.register("azureThirdPartyTest") {
dependsOn "integTest"
}