From caf77f7eeae63e6e602239fc05605464c7bf327d Mon Sep 17 00:00:00 2001 From: Ryan Ernst Date: Thu, 3 Dec 2015 14:52:51 -0800 Subject: [PATCH] Add integ-test-zip distribution --- build.gradle | 1 + .../gradle/test/ClusterConfiguration.groovy | 2 +- .../gradle/test/ClusterFormationTasks.groovy | 8 +++- .../elasticsearch/gradle/test/NodeInfo.groovy | 3 +- distribution/build.gradle | 2 +- distribution/integ-test-zip/build.gradle | 2 +- .../org/elasticsearch/test/rest/RestIT.java | 38 +++++++++++++++++++ settings.gradle | 1 + 8 files changed, 52 insertions(+), 5 deletions(-) create mode 100644 distribution/integ-test-zip/src/test/java/org/elasticsearch/test/rest/RestIT.java diff --git a/build.gradle b/build.gradle index 1326c8225e1..dac8232b172 100644 --- a/build.gradle +++ b/build.gradle @@ -109,6 +109,7 @@ subprojects { "org.elasticsearch:rest-api-spec:${version}": ':rest-api-spec', "org.elasticsearch:elasticsearch:${version}": ':core', "org.elasticsearch:test-framework:${version}": ':test-framework', + "org.elasticsearch.distribution.integ-test-zip:elasticsearch:${version}": ':distribution:integ-test-zip', "org.elasticsearch.distribution.zip:elasticsearch:${version}": ':distribution:zip', "org.elasticsearch.distribution.tar:elasticsearch:${version}": ':distribution:tar', "org.elasticsearch.distribution.rpm:elasticsearch:${version}": ':distribution:rpm', diff --git a/buildSrc/src/main/groovy/org/elasticsearch/gradle/test/ClusterConfiguration.groovy b/buildSrc/src/main/groovy/org/elasticsearch/gradle/test/ClusterConfiguration.groovy index 79a199e98e4..d09a5faff34 100644 --- a/buildSrc/src/main/groovy/org/elasticsearch/gradle/test/ClusterConfiguration.groovy +++ b/buildSrc/src/main/groovy/org/elasticsearch/gradle/test/ClusterConfiguration.groovy @@ -27,7 +27,7 @@ import org.gradle.api.tasks.Input class ClusterConfiguration { @Input - String distribution = 'zip' + String distribution = 'integ-test-zip' @Input int numNodes = 1 diff --git a/buildSrc/src/main/groovy/org/elasticsearch/gradle/test/ClusterFormationTasks.groovy b/buildSrc/src/main/groovy/org/elasticsearch/gradle/test/ClusterFormationTasks.groovy index 355939d88f6..7372c73c6d8 100644 --- a/buildSrc/src/main/groovy/org/elasticsearch/gradle/test/ClusterFormationTasks.groovy +++ b/buildSrc/src/main/groovy/org/elasticsearch/gradle/test/ClusterFormationTasks.groovy @@ -60,7 +60,12 @@ class ClusterFormationTasks { /** Adds a dependency on the given distribution */ static void configureDistributionDependency(Project project, String distro) { String elasticsearchVersion = VersionProperties.elasticsearch - String packaging = distro == 'tar' ? 'tar.gz' : distro + String packaging = distro + if (distro == 'tar') { + packaging = 'tar.gz' + } else if (distro == 'integ-test-zip') { + packaging = 'zip' + } project.configurations { elasticsearchDistro } @@ -138,6 +143,7 @@ class ClusterFormationTasks { by the source tree. If it isn't then Bad Things(TM) will happen. */ Task extract switch (node.config.distribution) { + case 'integ-test-zip': case 'zip': extract = project.tasks.create(name: name, type: Copy, dependsOn: extractDependsOn) { from { project.zipTree(project.configurations.elasticsearchDistro.singleFile) } diff --git a/buildSrc/src/main/groovy/org/elasticsearch/gradle/test/NodeInfo.groovy b/buildSrc/src/main/groovy/org/elasticsearch/gradle/test/NodeInfo.groovy index 2247c894dce..337eea3de97 100644 --- a/buildSrc/src/main/groovy/org/elasticsearch/gradle/test/NodeInfo.groovy +++ b/buildSrc/src/main/groovy/org/elasticsearch/gradle/test/NodeInfo.groovy @@ -173,6 +173,7 @@ class NodeInfo { static File homeDir(File baseDir, String distro) { String path switch (distro) { + case 'integ-test-zip': case 'zip': case 'tar': path = "elasticsearch-${VersionProperties.elasticsearch}" @@ -188,8 +189,8 @@ class NodeInfo { } static File confDir(File baseDir, String distro) { - String Path switch (distro) { + case 'integ-test-zip': case 'zip': case 'tar': return new File(homeDir(baseDir, distro), 'config') diff --git a/distribution/build.gradle b/distribution/build.gradle index ae7c5c2c0bd..ea2940d2b6f 100644 --- a/distribution/build.gradle +++ b/distribution/build.gradle @@ -136,7 +136,7 @@ subprojects { /***************************************************************************** * Zip and tgz configuration * *****************************************************************************/ -configure(subprojects.findAll { it.name == 'zip' || it.name == 'tar' }) { +configure(subprojects.findAll { it.name == 'zip' || it.name == 'tar' || it.name == 'integ-test-zip' }) { project.ext.archivesFiles = copySpec { into("elasticsearch-${version}") { with libFiles diff --git a/distribution/integ-test-zip/build.gradle b/distribution/integ-test-zip/build.gradle index d636e66f152..23191ff03a4 100644 --- a/distribution/integ-test-zip/build.gradle +++ b/distribution/integ-test-zip/build.gradle @@ -17,7 +17,7 @@ * under the License. */ -task buildZip(type: Zip, dependsOn: dependencyFiles) { +task buildZip(type: Zip) { baseName = 'elasticsearch' with archivesFiles } diff --git a/distribution/integ-test-zip/src/test/java/org/elasticsearch/test/rest/RestIT.java b/distribution/integ-test-zip/src/test/java/org/elasticsearch/test/rest/RestIT.java new file mode 100644 index 00000000000..fd12fd2e519 --- /dev/null +++ b/distribution/integ-test-zip/src/test/java/org/elasticsearch/test/rest/RestIT.java @@ -0,0 +1,38 @@ +/* + * 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. + */ + +package org.elasticsearch.test.rest; + +import com.carrotsearch.randomizedtesting.annotations.ParametersFactory; + +import org.elasticsearch.test.rest.parser.RestTestParseException; + +import java.io.IOException; + +/** Rest integration test. runs against external cluster in 'mvn verify' */ +public class RestIT extends ESRestTestCase { + public RestIT(RestTestCandidate testCandidate) { + super(testCandidate); + } + // we run them all sequentially: start simple! + @ParametersFactory + public static Iterable parameters() throws IOException, RestTestParseException { + return createParameters(0, 1); + } +} diff --git a/settings.gradle b/settings.gradle index 9cad47700cb..0791c3d1752 100644 --- a/settings.gradle +++ b/settings.gradle @@ -3,6 +3,7 @@ rootProject.name = 'elasticsearch' List projects = [ 'rest-api-spec', 'core', + 'distribution:integ-test-zip', 'distribution:zip', 'distribution:tar', 'distribution:deb',