Remove RPM and Debian integration tests

We have tests that manually unpackage the RPM and Debian package
distributions and start a cluster manually (not from the service) and
run a basic suite of integration tests against them. This is problematic
because it is not how the packages are intended to be used (instead,
they are intended to be installed using the package installation tools,
and started as services) and so violates assumptions that we make about
directory paths. This commit removes these integration tests, instead
relying on the packaging tests to ensure the packages are not
broken. Additionally, we add a sanity check that the package
distributions can be unpackaged. Finally, with this change we can remove
some leniency from elasticsearch-env about checking for the existence of
the environment file which the leniency was there solely for these
integration tests.

Relates #27725
This commit is contained in:
Jason Tedor 2017-12-11 15:40:10 -05:00 committed by GitHub
parent 6bc40e4bd3
commit cd474df972
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 46 additions and 141 deletions

View File

@ -269,35 +269,6 @@ class ClusterFormationTasks {
into node.baseDir
}
break;
case 'rpm':
File rpmDatabase = new File(node.baseDir, 'rpm-database')
File rpmExtracted = new File(node.baseDir, 'rpm-extracted')
/* Delay reading the location of the rpm file until task execution */
Object rpm = "${ -> configuration.singleFile}"
extract = project.tasks.create(name: name, type: LoggedExec, dependsOn: extractDependsOn) {
commandLine 'rpm', '--badreloc', '--nodeps', '--noscripts', '--notriggers',
'--dbpath', rpmDatabase,
'--relocate', "/=${rpmExtracted}",
'-i', rpm
doFirst {
rpmDatabase.deleteDir()
rpmExtracted.deleteDir()
}
outputs.dir rpmExtracted
}
break;
case 'deb':
/* Delay reading the location of the deb file until task execution */
File debExtracted = new File(node.baseDir, 'deb-extracted')
Object deb = "${ -> configuration.singleFile}"
extract = project.tasks.create(name: name, type: LoggedExec, dependsOn: extractDependsOn) {
commandLine 'dpkg-deb', '-x', deb, debExtracted
doFirst {
debExtracted.deleteDir()
}
outputs.dir debExtracted
}
break;
default:
throw new InvalidUserDataException("Unknown distribution: ${node.config.distribution}")
}

View File

@ -538,8 +538,8 @@ Map<String, String> expansionsForDistribution(distributionType) {
'def': 'if [ -z "$ES_PATH_CONF" ]; then ES_PATH_CONF="$ES_HOME"/config; done',
],
'source.path.env': [
'deb': 'if [ -f /etc/default/elasticsearch ]; then source /etc/default/elasticsearch; fi',
'rpm': 'if [ -f /etc/sysconfig/elasticsearch ]; then source /etc/sysconfig/elasticsearch; fi',
'deb': 'source /etc/default/elasticsearch',
'rpm': 'source /etc/sysconfig/elasticsearch',
'def': 'if [ -z "$ES_PATH_CONF" ]; then ES_PATH_CONF="$ES_HOME"/config; fi',
],
'path.logs': [

View File

@ -1,3 +1,5 @@
import org.elasticsearch.gradle.LoggedExec
/*
* Licensed to Elasticsearch under one or more contributor
* license agreements. See the NOTICE file distributed with
@ -42,9 +44,18 @@ artifacts {
archives buildDeb
}
integTest {
/* We use real deb tools to extract the deb file for testing so we have to
skip the test if they aren't around. */
enabled = new File('/usr/bin/dpkg-deb').exists() || // Standard location
new File('/usr/local/bin/dpkg-deb').exists() // Homebrew location
integTest.enabled = false
licenseHeaders.enabled = false
// task that sanity checks if the Deb archive can be extracted
task checkDeb(type: LoggedExec) {
onlyIf { new File('/usr/bin/dpkg-deb').exists() || new File('/usr/local/bin/dpkg-deb').exists() }
final File debExtracted = new File("${buildDir}", 'deb-extracted')
commandLine 'dpkg-deb', '-x', "${buildDir}/distributions/elasticsearch-${project.version}.deb", debExtracted
doFirst {
debExtracted.deleteDir()
}
}
checkDeb.dependsOn buildDeb
check.dependsOn checkDeb

View File

@ -1,36 +0,0 @@
/*
* 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.yaml.ClientYamlTestCandidate;
import org.elasticsearch.test.rest.yaml.ESClientYamlSuiteTestCase;
/** Rest integration test. Runs against a cluster started by {@code gradle integTest} */
public class DebClientYamlTestSuiteIT extends ESClientYamlSuiteTestCase {
public DebClientYamlTestSuiteIT(ClientYamlTestCandidate testCandidate) {
super(testCandidate);
}
@ParametersFactory
public static Iterable<Object[]> parameters() throws Exception {
return createParameters();
}
}

View File

@ -1,13 +0,0 @@
# Integration tests for distributions with modules
#
"Correct Modules Count":
- do:
cluster.state: {}
# Get master node id
- set: { master_node: master }
- do:
nodes.info: {}
- length: { nodes.$master.modules: ${expected.modules.count} }

View File

@ -17,6 +17,8 @@
* under the License.
*/
import org.elasticsearch.gradle.LoggedExec
task buildRpm(type: Rpm) {
dependsOn preparePackagingFiles
baseName 'elasticsearch' // this is what pom generation uses for artifactId
@ -54,10 +56,30 @@ artifacts {
archives buildRpm
}
integTest {
/* We use real rpm tools to extract the rpm file for testing so we have to
skip the test if they aren't around. */
enabled = new File('/bin/rpm').exists() || // Standard location
new File('/usr/bin/rpm').exists() || // Debian location
new File('/usr/local/bin/rpm').exists() // Homebrew location
integTest.enabled = false
licenseHeaders.enabled = false
// task that sanity checks if the RPM archive can be extracted
task checkRpm(type: LoggedExec) {
onlyIf { new File('/bin/rpm').exists() || new File('/usr/bin/rpm').exists() || new File('/usr/local/bin/rpm').exists() }
final File rpmDatabase = new File("${buildDir}", 'rpm-database')
final File rpmExtracted = new File("${buildDir}", 'rpm-extracted')
commandLine 'rpm',
'--badreloc',
'--nodeps',
'--noscripts',
'--notriggers',
'--dbpath',
rpmDatabase,
'--relocate',
"/=${rpmExtracted}",
'-i',
"${buildDir}/distributions/elasticsearch-${project.version}.rpm"
doFirst {
rpmDatabase.deleteDir()
rpmExtracted.deleteDir()
}
}
checkRpm.dependsOn buildRpm
check.dependsOn checkRpm

View File

@ -1,37 +0,0 @@
/*
* 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.yaml.ClientYamlTestCandidate;
import org.elasticsearch.test.rest.yaml.ESClientYamlSuiteTestCase;
/** Rest integration test. Runs against a cluster started by {@code gradle integTest} */
public class RpmClientYamlTestSuiteIT extends ESClientYamlSuiteTestCase {
public RpmClientYamlTestSuiteIT(ClientYamlTestCandidate testCandidate) {
super(testCandidate);
}
@ParametersFactory
public static Iterable<Object[]> parameters() throws Exception {
return createParameters();
}
}

View File

@ -1,13 +0,0 @@
# Integration tests for distributions with modules
#
"Correct Modules Count":
- do:
cluster.state: {}
# Get master node id
- set: { master_node: master }
- do:
nodes.info: {}
- length: { nodes.$master.modules: ${expected.modules.count} }