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
|
|
|
|
|
|
|
import org.elasticsearch.gradle.Architecture
|
2020-02-21 18:24:05 -05:00
|
|
|
import org.elasticsearch.gradle.VersionProperties
|
2020-02-03 03:44:55 -05:00
|
|
|
import org.elasticsearch.gradle.testfixtures.TestFixturesPlugin
|
|
|
|
|
|
|
|
apply plugin: 'elasticsearch.standalone-rest-test'
|
|
|
|
apply plugin: 'elasticsearch.test.fixtures'
|
2020-02-21 18:24:05 -05:00
|
|
|
apply plugin: 'elasticsearch.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
|
|
|
}
|
|
|
|
|
|
|
|
task copyKeystore(type: Sync) {
|
|
|
|
from project(':x-pack:plugin:core')
|
|
|
|
.file('src/test/resources/org/elasticsearch/xpack/security/transport/ssl/certs/simple/testnode.jks')
|
|
|
|
into "${buildDir}/certs"
|
|
|
|
doLast {
|
|
|
|
file("${buildDir}/certs").setReadable(true, false)
|
|
|
|
file("${buildDir}/certs/testnode.jks").setReadable(true, false)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-02-21 18:24:05 -05:00
|
|
|
elasticsearch_distributions {
|
|
|
|
docker {
|
|
|
|
type = 'docker'
|
2020-04-15 08:39:18 -04:00
|
|
|
architecture = Architecture.current()
|
2020-02-21 18:24:05 -05:00
|
|
|
flavor = System.getProperty('tests.distribution', 'default')
|
|
|
|
version = VersionProperties.getElasticsearch()
|
|
|
|
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
|
|
|
}
|
|
|
|
|
|
|
|
preProcessFixture {
|
|
|
|
dependsOn copyKeystore, elasticsearch_distributions.docker
|
2020-02-03 03:44:55 -05:00
|
|
|
doLast {
|
|
|
|
// tests expect to have an empty repo
|
|
|
|
project.delete(
|
|
|
|
"${buildDir}/repo",
|
|
|
|
"${buildDir}/oss-repo"
|
|
|
|
)
|
|
|
|
createAndSetWritable(
|
|
|
|
"${buildDir}/repo",
|
|
|
|
"${buildDir}/oss-repo",
|
|
|
|
"${buildDir}/logs/default-1",
|
|
|
|
"${buildDir}/logs/default-2",
|
|
|
|
"${buildDir}/logs/oss-1",
|
|
|
|
"${buildDir}/logs/oss-2"
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-02-21 18:24:05 -05:00
|
|
|
dockerCompose {
|
|
|
|
tcpPortsToIgnoreWhenWaiting = [9600, 9601]
|
|
|
|
if ('default'.equalsIgnoreCase(System.getProperty('tests.distribution', 'default'))) {
|
|
|
|
useComposeFiles = ['docker-compose.yml']
|
|
|
|
} else {
|
|
|
|
useComposeFiles = ['docker-compose-oss.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)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
processTestResources {
|
|
|
|
from project(':x-pack:plugin:core')
|
|
|
|
.file('src/test/resources/org/elasticsearch/xpack/security/transport/ssl/certs/simple/testnode.jks')
|
|
|
|
}
|
|
|
|
|
|
|
|
task integTest(type: Test) {
|
|
|
|
outputs.doNotCacheIf('Build cache is disabled for Docker tests') { true }
|
|
|
|
maxParallelForks = '1'
|
|
|
|
include '**/*IT.class'
|
|
|
|
}
|
|
|
|
|
|
|
|
check.dependsOn integTest
|