Skip to content

Commit e767662

Browse files
committed
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
1 parent a4cb015 commit e767662

File tree

8 files changed

+46
-141
lines changed

8 files changed

+46
-141
lines changed

buildSrc/src/main/groovy/org/elasticsearch/gradle/test/ClusterFormationTasks.groovy

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -269,35 +269,6 @@ class ClusterFormationTasks {
269269
into node.baseDir
270270
}
271271
break;
272-
case 'rpm':
273-
File rpmDatabase = new File(node.baseDir, 'rpm-database')
274-
File rpmExtracted = new File(node.baseDir, 'rpm-extracted')
275-
/* Delay reading the location of the rpm file until task execution */
276-
Object rpm = "${ -> configuration.singleFile}"
277-
extract = project.tasks.create(name: name, type: LoggedExec, dependsOn: extractDependsOn) {
278-
commandLine 'rpm', '--badreloc', '--nodeps', '--noscripts', '--notriggers',
279-
'--dbpath', rpmDatabase,
280-
'--relocate', "/=${rpmExtracted}",
281-
'-i', rpm
282-
doFirst {
283-
rpmDatabase.deleteDir()
284-
rpmExtracted.deleteDir()
285-
}
286-
outputs.dir rpmExtracted
287-
}
288-
break;
289-
case 'deb':
290-
/* Delay reading the location of the deb file until task execution */
291-
File debExtracted = new File(node.baseDir, 'deb-extracted')
292-
Object deb = "${ -> configuration.singleFile}"
293-
extract = project.tasks.create(name: name, type: LoggedExec, dependsOn: extractDependsOn) {
294-
commandLine 'dpkg-deb', '-x', deb, debExtracted
295-
doFirst {
296-
debExtracted.deleteDir()
297-
}
298-
outputs.dir debExtracted
299-
}
300-
break;
301272
default:
302273
throw new InvalidUserDataException("Unknown distribution: ${node.config.distribution}")
303274
}

distribution/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -538,8 +538,8 @@ Map<String, String> expansionsForDistribution(distributionType) {
538538
'def': 'if [ -z "$ES_PATH_CONF" ]; then ES_PATH_CONF="$ES_HOME"/config; done',
539539
],
540540
'source.path.env': [
541-
'deb': 'if [ -f /etc/default/elasticsearch ]; then source /etc/default/elasticsearch; fi',
542-
'rpm': 'if [ -f /etc/sysconfig/elasticsearch ]; then source /etc/sysconfig/elasticsearch; fi',
541+
'deb': 'source /etc/default/elasticsearch',
542+
'rpm': 'source /etc/sysconfig/elasticsearch',
543543
'def': 'if [ -z "$ES_PATH_CONF" ]; then ES_PATH_CONF="$ES_HOME"/config; fi',
544544
],
545545
'path.logs': [

distribution/deb/build.gradle

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import org.elasticsearch.gradle.LoggedExec
2+
13
/*
24
* Licensed to Elasticsearch under one or more contributor
35
* license agreements. See the NOTICE file distributed with
@@ -42,9 +44,18 @@ artifacts {
4244
archives buildDeb
4345
}
4446

45-
integTest {
46-
/* We use real deb tools to extract the deb file for testing so we have to
47-
skip the test if they aren't around. */
48-
enabled = new File('/usr/bin/dpkg-deb').exists() || // Standard location
49-
new File('/usr/local/bin/dpkg-deb').exists() // Homebrew location
47+
integTest.enabled = false
48+
licenseHeaders.enabled = false
49+
50+
// task that sanity checks if the Deb archive can be extracted
51+
task checkDeb(type: LoggedExec) {
52+
onlyIf { new File('/usr/bin/dpkg-deb').exists() || new File('/usr/local/bin/dpkg-deb').exists() }
53+
final File debExtracted = new File("${buildDir}", 'deb-extracted')
54+
commandLine 'dpkg-deb', '-x', "${buildDir}/distributions/elasticsearch-${project.version}.deb", debExtracted
55+
doFirst {
56+
debExtracted.deleteDir()
57+
}
5058
}
59+
60+
checkDeb.dependsOn buildDeb
61+
check.dependsOn checkDeb

distribution/deb/src/test/java/org/elasticsearch/test/rest/DebClientYamlTestSuiteIT.java

Lines changed: 0 additions & 36 deletions
This file was deleted.

distribution/deb/src/test/resources/rest-api-spec/test/smoke_test_plugins/10_modules.yml

Lines changed: 0 additions & 13 deletions
This file was deleted.

distribution/rpm/build.gradle

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
* under the License.
1818
*/
1919

20+
import org.elasticsearch.gradle.LoggedExec
21+
2022
task buildRpm(type: Rpm) {
2123
dependsOn preparePackagingFiles
2224
baseName 'elasticsearch' // this is what pom generation uses for artifactId
@@ -54,10 +56,30 @@ artifacts {
5456
archives buildRpm
5557
}
5658

57-
integTest {
58-
/* We use real rpm tools to extract the rpm file for testing so we have to
59-
skip the test if they aren't around. */
60-
enabled = new File('/bin/rpm').exists() || // Standard location
61-
new File('/usr/bin/rpm').exists() || // Debian location
62-
new File('/usr/local/bin/rpm').exists() // Homebrew location
59+
integTest.enabled = false
60+
licenseHeaders.enabled = false
61+
62+
// task that sanity checks if the RPM archive can be extracted
63+
task checkRpm(type: LoggedExec) {
64+
onlyIf { new File('/bin/rpm').exists() || new File('/usr/bin/rpm').exists() || new File('/usr/local/bin/rpm').exists() }
65+
final File rpmDatabase = new File("${buildDir}", 'rpm-database')
66+
final File rpmExtracted = new File("${buildDir}", 'rpm-extracted')
67+
commandLine 'rpm',
68+
'--badreloc',
69+
'--nodeps',
70+
'--noscripts',
71+
'--notriggers',
72+
'--dbpath',
73+
rpmDatabase,
74+
'--relocate',
75+
"/=${rpmExtracted}",
76+
'-i',
77+
"${buildDir}/distributions/elasticsearch-${project.version}.rpm"
78+
doFirst {
79+
rpmDatabase.deleteDir()
80+
rpmExtracted.deleteDir()
81+
}
6382
}
83+
84+
checkRpm.dependsOn buildRpm
85+
check.dependsOn checkRpm

distribution/rpm/src/test/java/org/elasticsearch/test/rest/RpmClientYamlTestSuiteIT.java

Lines changed: 0 additions & 37 deletions
This file was deleted.

distribution/rpm/src/test/resources/rest-api-spec/test/smoke_test_plugins/10_modules.yml

Lines changed: 0 additions & 13 deletions
This file was deleted.

0 commit comments

Comments
 (0)