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-02-03 03:44:55 -05: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-04-15 08:39:18 -04:00
|
|
|
|
2021-03-08 13:06:46 -05:00
|
|
|
import org.opensearch.gradle.Architecture
|
|
|
|
import org.opensearch.gradle.VersionProperties
|
|
|
|
import org.opensearch.gradle.testfixtures.TestFixturesPlugin
|
2020-02-03 03:44:55 -05:00
|
|
|
|
2021-03-08 13:06:46 -05:00
|
|
|
apply plugin: 'opensearch.standalone-rest-test'
|
|
|
|
apply plugin: 'opensearch.test.fixtures'
|
|
|
|
apply plugin: 'opensearch.internal-distribution-download'
|
2020-02-03 03:44:55 -05:00
|
|
|
|
|
|
|
testFixtures.useFixture()
|
|
|
|
|
|
|
|
dependencies {
|
2020-06-14 16:30:44 -04:00
|
|
|
testImplementation project(':client:rest-high-level')
|
2020-02-03 03:44:55 -05:00
|
|
|
}
|
|
|
|
|
2021-03-18 19:14:19 -04:00
|
|
|
opensearch_distributions {
|
2020-02-21 18:24:05 -05:00
|
|
|
docker {
|
|
|
|
type = 'docker'
|
2020-04-15 08:39:18 -04:00
|
|
|
architecture = Architecture.current()
|
2021-04-09 13:24:41 -04:00
|
|
|
version = VersionProperties.getOpenSearch()
|
2020-02-21 18:24:05 -05:00
|
|
|
failIfUnavailable = false // This ensures we skip this testing if Docker is unavailable
|
2020-02-03 03:44:55 -05:00
|
|
|
}
|
2020-02-21 18:24:05 -05:00
|
|
|
}
|
|
|
|
|
2021-12-18 10:57:04 -05:00
|
|
|
tasks.named("preProcessFixture").configure {
|
2021-03-18 19:14:19 -04:00
|
|
|
dependsOn opensearch_distributions.docker
|
2021-12-18 10:57:04 -05:00
|
|
|
// always run the task, otherwise the folders won't be created
|
|
|
|
outputs.upToDateWhen {
|
|
|
|
false
|
|
|
|
}
|
2020-02-03 03:44:55 -05:00
|
|
|
doLast {
|
|
|
|
// tests expect to have an empty repo
|
|
|
|
project.delete(
|
2021-04-20 12:27:40 -04:00
|
|
|
"${buildDir}/repo"
|
2020-02-03 03:44:55 -05:00
|
|
|
)
|
|
|
|
createAndSetWritable(
|
2021-04-20 12:27:40 -04:00
|
|
|
"${buildDir}/repo",
|
|
|
|
"${buildDir}/logs/1",
|
|
|
|
"${buildDir}/logs/2"
|
2020-02-03 03:44:55 -05:00
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
2021-04-09 13:24:41 -04:00
|
|
|
|
2020-02-21 18:24:05 -05:00
|
|
|
dockerCompose {
|
|
|
|
tcpPortsToIgnoreWhenWaiting = [9600, 9601]
|
2021-04-09 13:24:41 -04:00
|
|
|
useComposeFiles = ['docker-compose.yml']
|
2020-02-03 03:44:55 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
def createAndSetWritable(Object... locations) {
|
|
|
|
locations.each { location ->
|
|
|
|
File file = file(location)
|
|
|
|
file.mkdirs()
|
|
|
|
file.setWritable(true, false)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-07-31 07:09:04 -04:00
|
|
|
tasks.register("integTest", Test) {
|
2020-02-03 03:44:55 -05:00
|
|
|
outputs.doNotCacheIf('Build cache is disabled for Docker tests') { true }
|
|
|
|
maxParallelForks = '1'
|
|
|
|
include '**/*IT.class'
|
|
|
|
}
|
|
|
|
|
2020-07-31 07:09:04 -04:00
|
|
|
tasks.named("check").configure { dependsOn "integTest" }
|
2021-12-18 10:57:04 -05:00
|
|
|
|
|
|
|
tasks.named("composeUp").configure {
|
|
|
|
dependsOn preProcessFixture
|
|
|
|
}
|