Skip to content

Commit 363c404

Browse files
authored
Build: Remove rest tests on archive distribution projects (elastic#28952)
This commit removes running rest tests on the full zip and tar distributions in favor of doing a simple extraction check like is done for rpm and deb files. The rest tests are still run on the integ test zip, at least for now (this should eventually be moved out to a different location).
1 parent e816782 commit 363c404

File tree

5 files changed

+26
-105
lines changed

5 files changed

+26
-105
lines changed

distribution/archives/build.gradle

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import org.apache.tools.ant.taskdefs.condition.Os
2121
import org.apache.tools.ant.filters.FixCrLfFilter
2222
import org.elasticsearch.gradle.BuildPlugin
2323
import org.elasticsearch.gradle.EmptyDirTask
24+
import org.elasticsearch.gradle.LoggedExec
2425
import org.elasticsearch.gradle.MavenFilteringHack
2526
import org.elasticsearch.gradle.plugin.PluginBuildPlugin
2627

@@ -125,19 +126,39 @@ subprojects {
125126
artifacts {
126127
'default' buildDist
127128
}
129+
130+
// sanity checks if a archives can be extracted
131+
File extractionDir = new File(buildDir, 'extracted')
132+
task testExtraction(type: LoggedExec) {
133+
dependsOn buildDist
134+
doFirst {
135+
project.delete(extractionDir)
136+
extractionDir.mkdirs()
137+
}
138+
}
139+
if (project.name.contains('zip')) {
140+
testExtraction {
141+
onlyIf { new File('/bin/unzip').exists() || new File('/usr/bin/unzip').exists() || new File('/usr/local/bin/unzip').exists() }
142+
commandLine 'unzip', "${-> buildDist.outputs.files.singleFile}", '-d', extractionDir
143+
}
144+
} else { // tar
145+
testExtraction {
146+
onlyIf { new File('/bin/tar').exists() || new File('/usr/bin/tar').exists() || new File('/usr/local/bin/tar').exists() }
147+
commandLine 'tar', '-xvzf', "${-> buildDist.outputs.files.singleFile}", '-C', extractionDir
148+
}
149+
}
150+
check.dependsOn testExtraction
128151
}
129152

130153
/*****************************************************************************
131154
* Rest test config *
132155
*****************************************************************************/
133-
subprojects {
156+
configure(subprojects.findAll { it.name == 'integ-test-zip' }) {
134157
apply plugin: 'elasticsearch.standalone-rest-test'
135158
apply plugin: 'elasticsearch.rest-test'
136159

137-
if (project.name == 'integ-test-zip') {
138-
integTest {
139-
includePackaged true
140-
}
160+
integTest {
161+
includePackaged true
141162
}
142163

143164
integTestCluster {

distribution/archives/tar/src/test/java/org/elasticsearch/test/rest/TarClientYamlTestSuiteIT.java

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

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

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

distribution/archives/zip/src/test/java/org/elasticsearch/test/rest/ZipClientYamlTestSuiteIT.java

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

distribution/archives/zip/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)