Skip to content

Commit bc197b0

Browse files
committed
[test] include oss tar in packaging tests (#30155)
Add the oss tar distribution to the packaging test plugin. Test the oss tar distribution in the core packaging tests, and the non-oss tar distribution in the x-pack packaging tests.
1 parent c8d375b commit bc197b0

File tree

4 files changed

+18
-10
lines changed

4 files changed

+18
-10
lines changed

buildSrc/src/main/groovy/org/elasticsearch/gradle/vagrant/VagrantTestPlugin.groovy

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,15 @@ class VagrantTestPlugin implements Plugin<Project> {
3737
'ubuntu-1404',
3838
]
3939

40-
/** All onboarded archives by default, available for Bats tests even if not used **/
41-
static List<String> DISTRIBUTION_ARCHIVES = ['tar', 'rpm', 'deb', 'oss-rpm', 'oss-deb']
40+
/** All distributions to bring into test VM, whether or not they are used **/
41+
static List<String> DISTRIBUTIONS = [
42+
'archives:tar',
43+
'archives:oss-tar',
44+
'packages:rpm',
45+
'packages:oss-rpm',
46+
'packages:deb',
47+
'packages:oss-deb'
48+
]
4249

4350
/** Packages onboarded for upgrade tests **/
4451
static List<String> UPGRADE_FROM_ARCHIVES = ['rpm', 'deb']
@@ -117,13 +124,8 @@ class VagrantTestPlugin implements Plugin<Project> {
117124
upgradeFromVersion = Version.fromString(upgradeFromVersionRaw)
118125
}
119126

120-
DISTRIBUTION_ARCHIVES.each {
127+
DISTRIBUTIONS.each {
121128
// Adds a dependency for the current version
122-
if (it == 'tar') {
123-
it = 'archives:tar'
124-
} else {
125-
it = "packages:${it}"
126-
}
127129
project.dependencies.add(PACKAGING_CONFIGURATION,
128130
project.dependencies.project(path: ":distribution:${it}", configuration: 'default'))
129131
}

qa/vagrant/src/test/resources/packaging/tests/20_tar_package.bats

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@ setup() {
5555
}
5656

5757
@test "[TAR] archive is available" {
58-
count=$(find . -type f -name 'elasticsearch*.tar.gz' | wc -l)
58+
local version=$(cat version)
59+
count=$(find . -type f -name "${PACKAGE_NAME}-${version}.tar.gz" | wc -l)
5960
[ "$count" -eq 1 ]
6061
}
6162

qa/vagrant/src/test/resources/packaging/utils/tar.bash

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,12 @@
3535
install_archive() {
3636
export ESHOME=${1:-/tmp/elasticsearch}
3737

38+
local version=$(cat version)
39+
3840
echo "Unpacking tarball to $ESHOME"
3941
rm -rf /tmp/untar
4042
mkdir -p /tmp/untar
41-
tar -xzpf elasticsearch*.tar.gz -C /tmp/untar
43+
tar -xzpf "${PACKAGE_NAME}-${version}.tar.gz" -C /tmp/untar
4244

4345
find /tmp/untar -depth -type d -name 'elasticsearch*' -exec mv {} "$ESHOME" \; > /dev/null
4446

@@ -79,6 +81,8 @@ export_elasticsearch_paths() {
7981
export ESSCRIPTS="$ESCONFIG/scripts"
8082
export ESDATA="$ESHOME/data"
8183
export ESLOG="$ESHOME/logs"
84+
85+
export PACKAGE_NAME=${PACKAGE_NAME:-"elasticsearch-oss"}
8286
}
8387

8488
# Checks that all directories & files are correctly installed

x-pack/qa/vagrant/src/test/resources/packaging/tests/10_basic.bats

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ load $BATS_UTILS/xpack.bash
1919
setup() {
2020
skip_not_tar_gz
2121
export ESHOME=/tmp/elasticsearch
22+
export PACKAGE_NAME="elasticsearch"
2223
export_elasticsearch_paths
2324
export ESPLUGIN_COMMAND_USER=elasticsearch
2425
}

0 commit comments

Comments
 (0)