/* * 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. */ import org.elasticsearch.gradle.testfixtures.TestFixturesPlugin apply plugin: 'elasticsearch.standalone-rest-test' apply plugin: 'elasticsearch.test.fixtures' testFixtures.useFixture() configurations { restSpec } dependencies { restSpec project(':rest-api-spec') testCompile project(':client:rest-high-level') } 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) } } preProcessFixture { if (TestFixturesPlugin.dockerComposeSupported()) { if ('default'.equalsIgnoreCase(System.getProperty('tests.distribution', 'default'))) { dependsOn ":distribution:docker:buildDockerImage" } else { dependsOn ":distribution:docker:buildOssDockerImage" } } dependsOn copyKeystore 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" ) } } if (TestFixturesPlugin.dockerComposeSupported()) { dockerCompose { tcpPortsToIgnoreWhenWaiting = [9600, 9601] if ('default'.equalsIgnoreCase(System.getProperty('tests.distribution', 'default'))) { useComposeFiles = ['docker-compose.yml'] } else { useComposeFiles = ['docker-compose-oss.yml'] } } } def createAndSetWritable(Object... locations) { locations.each { location -> File file = file(location) file.mkdirs() file.setWritable(true, false) } } processTestResources { from({ zipTree(configurations.restSpec.singleFile) }) { include 'rest-api-spec/api/**' } from project(':x-pack:plugin:core') .file('src/test/resources/org/elasticsearch/xpack/security/transport/ssl/certs/simple/testnode.jks') dependsOn configurations.restSpec } task integTest(type: Test) { outputs.doNotCacheIf('Build cache is disabled for Docker tests') { true } maxParallelForks = '1' include '**/*IT.class' // don't add the tasks to build the docker images if we have no way of testing them if (TestFixturesPlugin.dockerComposeSupported()) { dependsOn ":distribution:docker:buildDockerImage" } } check.dependsOn integTest