2021-04-09 15:28:18 -04:00
|
|
|
/*
|
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
*
|
|
|
|
* The OpenSearch Contributors require contributions made to
|
|
|
|
* this file be licensed under the Apache-2.0 license or a
|
|
|
|
* compatible open source license.
|
|
|
|
*
|
|
|
|
* Modifications Copyright OpenSearch Contributors. See
|
|
|
|
* GitHub history for details.
|
|
|
|
*/
|
2020-06-02 05:26:58 -04:00
|
|
|
|
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.
|
|
|
|
*/
|
2021-04-09 15:28:18 -04:00
|
|
|
|
|
|
|
import org.opensearch.gradle.MavenFilteringHack
|
|
|
|
import org.opensearch.gradle.info.BuildParams
|
|
|
|
import org.opensearch.gradle.test.InternalClusterTestPlugin
|
|
|
|
|
|
|
|
import static org.opensearch.gradle.PropertyNormalization.DEFAULT
|
|
|
|
import static org.opensearch.gradle.PropertyNormalization.IGNORE_VALUE
|
|
|
|
|
2021-03-11 00:06:21 -05:00
|
|
|
apply plugin: 'opensearch.yaml-rest-test'
|
|
|
|
apply plugin: 'opensearch.internal-cluster-test'
|
2015-10-29 14:40:19 -04:00
|
|
|
|
2021-03-11 00:06:21 -05:00
|
|
|
opensearchplugin {
|
2015-10-29 14:40:19 -04:00
|
|
|
description 'The Azure Repository plugin adds support for Azure storage repositories.'
|
2021-03-11 00:06:21 -05:00
|
|
|
classname 'org.opensearch.repositories.azure.AzureRepositoryPlugin'
|
2015-10-29 14:40:19 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
dependencies {
|
2021-11-11 15:57:34 -05:00
|
|
|
api 'com.azure:azure-core:1.22.0'
|
|
|
|
api 'com.azure:azure-storage-common:12.14.0'
|
|
|
|
api 'com.azure:azure-core-http-netty:1.11.2'
|
2021-10-18 19:48:32 -04:00
|
|
|
api "io.netty:netty-codec-dns:${versions.netty}"
|
|
|
|
api "io.netty:netty-codec-socks:${versions.netty}"
|
|
|
|
api "io.netty:netty-codec-http2:${versions.netty}"
|
|
|
|
api "io.netty:netty-handler-proxy:${versions.netty}"
|
|
|
|
api "io.netty:netty-resolver-dns:${versions.netty}"
|
|
|
|
api "io.netty:netty-transport-native-unix-common:${versions.netty}"
|
|
|
|
implementation project(':modules:transport-netty4')
|
2021-11-11 15:57:34 -05:00
|
|
|
api 'com.azure:azure-storage-blob:12.14.1'
|
2021-10-18 19:48:32 -04:00
|
|
|
api 'org.reactivestreams:reactive-streams:1.0.3'
|
2021-10-20 15:27:18 -04:00
|
|
|
api 'io.projectreactor:reactor-core:3.4.11'
|
2021-11-11 15:57:34 -05:00
|
|
|
api 'io.projectreactor.netty:reactor-netty:1.0.13'
|
|
|
|
api 'io.projectreactor.netty:reactor-netty-core:1.0.13'
|
|
|
|
api 'io.projectreactor.netty:reactor-netty-http:1.0.13'
|
2021-10-18 19:48:32 -04:00
|
|
|
api "org.slf4j:slf4j-api:${versions.slf4j}"
|
|
|
|
api "com.fasterxml.jackson.core:jackson-annotations:${versions.jackson}"
|
|
|
|
api "com.fasterxml.jackson.core:jackson-databind:${versions.jackson}"
|
|
|
|
api "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:${versions.jackson}"
|
|
|
|
api "com.fasterxml.jackson.dataformat:jackson-dataformat-xml:${versions.jackson}"
|
|
|
|
api "com.fasterxml.jackson.module:jackson-module-jaxb-annotations:${versions.jackson}"
|
|
|
|
api 'org.codehaus.woodstox:stax2-api:4.2.1'
|
|
|
|
implementation 'com.fasterxml.woodstox:woodstox-core:6.1.1'
|
2021-05-25 17:57:36 -04:00
|
|
|
runtimeOnly 'com.google.guava:guava:30.1.1-jre'
|
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'
|
2021-10-18 19:48:32 -04:00
|
|
|
mapping from: /netty-.*/, to: 'netty'
|
|
|
|
mapping from: /reactor-.*/, to: 'reactor'
|
2015-10-29 14:40:19 -04:00
|
|
|
}
|
|
|
|
|
2019-01-07 10:24:19 -05:00
|
|
|
thirdPartyAudit {
|
2019-11-14 06:01:23 -05:00
|
|
|
ignoreMissingClasses(
|
|
|
|
// Optional and not enabled by Elasticsearch
|
2021-05-25 17:57:36 -04:00
|
|
|
'com.google.common.util.concurrent.internal.InternalFutureFailureAccess',
|
2021-10-18 19:48:32 -04:00
|
|
|
'com.google.common.util.concurrent.internal.InternalFutures',
|
|
|
|
'com.azure.storage.internal.avro.implementation.AvroObject',
|
|
|
|
'com.azure.storage.internal.avro.implementation.AvroReader',
|
|
|
|
'com.azure.storage.internal.avro.implementation.AvroReaderFactory',
|
|
|
|
'com.azure.storage.internal.avro.implementation.schema.AvroSchema',
|
|
|
|
'com.ctc.wstx.shaded.msv_core.driver.textui.Driver',
|
|
|
|
'io.micrometer.core.instrument.Clock',
|
|
|
|
'io.micrometer.core.instrument.Counter',
|
|
|
|
'io.micrometer.core.instrument.Counter$Builder',
|
|
|
|
'io.micrometer.core.instrument.DistributionSummary',
|
|
|
|
'io.micrometer.core.instrument.DistributionSummary$Builder',
|
|
|
|
'io.micrometer.core.instrument.Gauge',
|
|
|
|
'io.micrometer.core.instrument.Gauge$Builder',
|
|
|
|
'io.micrometer.core.instrument.Meter',
|
|
|
|
'io.micrometer.core.instrument.MeterRegistry',
|
|
|
|
'io.micrometer.core.instrument.Metrics',
|
|
|
|
'io.micrometer.core.instrument.Tag',
|
|
|
|
'io.micrometer.core.instrument.Tags',
|
|
|
|
'io.micrometer.core.instrument.Timer',
|
|
|
|
'io.micrometer.core.instrument.Timer$Builder',
|
|
|
|
'io.micrometer.core.instrument.Timer$Sample',
|
|
|
|
'io.micrometer.core.instrument.binder.jvm.ExecutorServiceMetrics',
|
|
|
|
'io.micrometer.core.instrument.composite.CompositeMeterRegistry',
|
|
|
|
'io.micrometer.core.instrument.search.Search',
|
|
|
|
'io.netty.channel.epoll.Epoll',
|
|
|
|
'io.netty.channel.epoll.EpollDatagramChannel',
|
|
|
|
'io.netty.channel.epoll.EpollDomainDatagramChannel',
|
|
|
|
'io.netty.channel.epoll.EpollDomainSocketChannel',
|
|
|
|
'io.netty.channel.epoll.EpollEventLoopGroup',
|
|
|
|
'io.netty.channel.epoll.EpollServerDomainSocketChannel',
|
|
|
|
'io.netty.channel.epoll.EpollServerSocketChannel',
|
|
|
|
'io.netty.channel.epoll.EpollSocketChannel',
|
|
|
|
'io.netty.channel.kqueue.KQueue',
|
|
|
|
'io.netty.channel.kqueue.KQueueDatagramChannel',
|
|
|
|
'io.netty.channel.kqueue.KQueueDomainDatagramChannel',
|
|
|
|
'io.netty.channel.kqueue.KQueueDomainSocketChannel',
|
|
|
|
'io.netty.channel.kqueue.KQueueEventLoopGroup',
|
|
|
|
'io.netty.channel.kqueue.KQueueServerDomainSocketChannel',
|
|
|
|
'io.netty.channel.kqueue.KQueueServerSocketChannel',
|
|
|
|
'io.netty.channel.kqueue.KQueueSocketChannel',
|
|
|
|
'io.netty.handler.codec.haproxy.HAProxyMessage',
|
|
|
|
'io.netty.handler.codec.haproxy.HAProxyMessageDecoder',
|
|
|
|
'io.netty.incubator.channel.uring.IOUring',
|
|
|
|
'io.netty.incubator.channel.uring.IOUringDatagramChannel',
|
|
|
|
'io.netty.incubator.channel.uring.IOUringEventLoopGroup',
|
|
|
|
'io.netty.incubator.channel.uring.IOUringServerSocketChannel',
|
|
|
|
'io.netty.incubator.channel.uring.IOUringSocketChannel',
|
|
|
|
'javax.activation.DataHandler',
|
|
|
|
'javax.activation.DataSource',
|
|
|
|
'javax.xml.bind.JAXBElement',
|
|
|
|
'javax.xml.bind.annotation.XmlAccessOrder',
|
|
|
|
'javax.xml.bind.annotation.XmlAccessType',
|
|
|
|
'javax.xml.bind.annotation.XmlAccessorOrder',
|
|
|
|
'javax.xml.bind.annotation.XmlAccessorType',
|
|
|
|
'javax.xml.bind.annotation.XmlAttribute',
|
|
|
|
'javax.xml.bind.annotation.XmlElement',
|
|
|
|
'javax.xml.bind.annotation.XmlElement$DEFAULT',
|
|
|
|
'javax.xml.bind.annotation.XmlElementRef',
|
|
|
|
'javax.xml.bind.annotation.XmlElementRefs',
|
|
|
|
'javax.xml.bind.annotation.XmlElementWrapper',
|
|
|
|
'javax.xml.bind.annotation.XmlElements',
|
|
|
|
'javax.xml.bind.annotation.XmlEnum',
|
|
|
|
'javax.xml.bind.annotation.XmlEnumValue',
|
|
|
|
'javax.xml.bind.annotation.XmlID',
|
|
|
|
'javax.xml.bind.annotation.XmlIDREF',
|
|
|
|
'javax.xml.bind.annotation.XmlRootElement',
|
|
|
|
'javax.xml.bind.annotation.XmlSeeAlso',
|
|
|
|
'javax.xml.bind.annotation.XmlTransient',
|
|
|
|
'javax.xml.bind.annotation.XmlType',
|
|
|
|
'javax.xml.bind.annotation.XmlValue',
|
|
|
|
'javax.xml.bind.annotation.adapters.XmlAdapter',
|
|
|
|
'javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter',
|
|
|
|
'javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter$DEFAULT',
|
|
|
|
'javax.xml.bind.annotation.adapters.XmlJavaTypeAdapters',
|
|
|
|
'kotlin.TypeCastException',
|
|
|
|
'kotlin.collections.ArraysKt',
|
|
|
|
'kotlin.jvm.JvmClassMappingKt',
|
|
|
|
'kotlin.jvm.functions.Function0',
|
|
|
|
'kotlin.jvm.functions.Function1',
|
|
|
|
'kotlin.jvm.internal.FunctionReference',
|
|
|
|
'kotlin.jvm.internal.Intrinsics',
|
|
|
|
'kotlin.jvm.internal.Reflection',
|
|
|
|
'kotlin.jvm.internal.markers.KMappedMarker',
|
|
|
|
'kotlin.reflect.KClass',
|
|
|
|
'kotlin.reflect.KDeclarationContainer',
|
|
|
|
'kotlin.sequences.Sequence',
|
|
|
|
'org.osgi.framework.BundleActivator',
|
|
|
|
'org.osgi.framework.BundleContext',
|
|
|
|
'org.slf4j.impl.StaticLoggerBinder',
|
|
|
|
'org.slf4j.impl.StaticMDCBinder',
|
|
|
|
'org.slf4j.impl.StaticMarkerBinder',
|
|
|
|
'reactor.blockhound.BlockHound$Builder',
|
|
|
|
'reactor.blockhound.integration.BlockHoundIntegration'
|
2019-11-14 06:01:23 -05:00
|
|
|
)
|
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',
|
2021-05-25 17:57:36 -04:00
|
|
|
'com.google.common.hash.Striped64',
|
|
|
|
'com.google.common.hash.Striped64$1',
|
|
|
|
'com.google.common.hash.Striped64$Cell',
|
2019-11-14 06:01:23 -05:00
|
|
|
'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',
|
2021-10-18 19:48:32 -04:00
|
|
|
'com.google.common.primitives.UnsignedBytes$LexicographicalComparatorHolder$UnsafeComparator$1',
|
|
|
|
'reactor.core.publisher.Traces$SharedSecretsCallSiteSupplierFactory$TracingException'
|
2019-11-14 06:01:23 -05:00
|
|
|
)
|
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
|
|
|
|
|
2021-03-11 00:06:21 -05:00
|
|
|
apply plugin: 'opensearch.test.fixtures'
|
2020-06-02 05:26:58 -04:00
|
|
|
testFixtures.useFixture ':test:fixtures:azure-fixture', 'azure-fixture'
|
|
|
|
}
|
|
|
|
|
|
|
|
Map<String, Object> expansions = [
|
|
|
|
'container': azureContainer,
|
|
|
|
'base_path': azureBasePath + "_integration_tests"
|
|
|
|
]
|
|
|
|
|
2020-07-29 12:19:44 -04:00
|
|
|
processYamlRestTestResources {
|
2020-06-02 05:26:58 -04:00
|
|
|
inputs.properties(expansions)
|
|
|
|
MavenFilteringHack.filter(it, expansions)
|
|
|
|
}
|
|
|
|
|
2020-07-29 12:19:44 -04:00
|
|
|
internalClusterTest {
|
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 {
|
2020-07-29 12:19:44 -04:00
|
|
|
yamlRestTest {
|
2020-06-02 05:26:58 -04: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
|
|
|
|
}
|
|
|
|
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) {
|
2020-07-29 12:19:44 -04:00
|
|
|
SourceSetContainer sourceSets = project.getExtensions().getByType(SourceSetContainer.class);
|
|
|
|
SourceSet internalTestSourceSet = sourceSets.getByName(InternalClusterTestPlugin.SOURCE_SET_NAME)
|
|
|
|
setTestClassesDirs(internalTestSourceSet.getOutput().getClassesDirs())
|
|
|
|
setClasspath(internalTestSourceSet.getRuntimeClasspath())
|
|
|
|
dependsOn tasks.internalClusterTest
|
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
|
|
|
}
|
2021-12-16 16:10:52 -05:00
|
|
|
|
|
|
|
task azureThirdPartyDefaultXmlTest(type: Test) {
|
|
|
|
SourceSetContainer sourceSets = project.getExtensions().getByType(SourceSetContainer.class);
|
|
|
|
SourceSet internalTestSourceSet = sourceSets.getByName(InternalClusterTestPlugin.SOURCE_SET_NAME)
|
|
|
|
setTestClassesDirs(internalTestSourceSet.getOutput().getClassesDirs())
|
|
|
|
setClasspath(internalTestSourceSet.getRuntimeClasspath())
|
|
|
|
dependsOn tasks.internalClusterTest
|
|
|
|
include '**/AzureStorageCleanupThirdPartyTests.class'
|
|
|
|
systemProperty 'javax.xml.stream.XMLInputFactory', "com.sun.xml.internal.stream.XMLInputFactoryImpl"
|
|
|
|
systemProperty 'test.azure.account', azureAccount ? azureAccount : ""
|
|
|
|
systemProperty 'test.azure.key', azureKey ? azureKey : ""
|
|
|
|
systemProperty 'test.azure.sas_token', azureSasToken ? azureSasToken : ""
|
|
|
|
systemProperty 'test.azure.container', azureContainer ? azureContainer : ""
|
|
|
|
systemProperty 'test.azure.base', (azureBasePath ? azureBasePath : "") + "_third_party_tests_" + BuildParams.testSeed
|
|
|
|
if (useFixture) {
|
|
|
|
nonInputProperties.systemProperty 'test.azure.endpoint_suffix', "${-> azureAddress.call() }"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
check.dependsOn(azureThirdPartyTest, azureThirdPartyDefaultXmlTest)
|