Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[test] include oss tar in packaging tests #30155

Merged
merged 2 commits into from
Apr 26, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,15 @@ class VagrantTestPlugin implements Plugin<Project> {
'ubuntu-1404',
]

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

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

DISTRIBUTION_ARCHIVES.each {
DISTRIBUTIONS.each {
// Adds a dependency for the current version
if (it == 'tar') {
it = 'archives:tar'
} else {
it = "packages:${it}"
}
project.dependencies.add(PACKAGING_CONFIGURATION,
project.dependencies.project(path: ":distribution:${it}", configuration: 'default'))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ setup() {
}

@test "[TAR] archive is available" {
count=$(find . -type f -name 'elasticsearch*.tar.gz' | wc -l)
local version=$(cat version)
count=$(find . -type f -name "${ARCHIVE_NAME}-${version}.tar.gz" | wc -l)
[ "$count" -eq 1 ]
}

Expand Down
6 changes: 5 additions & 1 deletion qa/vagrant/src/test/resources/packaging/utils/tar.bash
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,12 @@
install_archive() {
export ESHOME=${1:-/tmp/elasticsearch}

local version=$(cat version)

echo "Unpacking tarball to $ESHOME"
rm -rf /tmp/untar
mkdir -p /tmp/untar
tar -xzpf elasticsearch*.tar.gz -C /tmp/untar
tar -xzpf "${ARCHIVE_NAME}-${version}.tar.gz" -C /tmp/untar

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

Expand Down Expand Up @@ -79,6 +81,8 @@ export_elasticsearch_paths() {
export ESSCRIPTS="$ESCONFIG/scripts"
export ESDATA="$ESHOME/data"
export ESLOG="$ESHOME/logs"

export ARCHIVE_NAME=${ARCHIVE_NAME:-"elasticsearch-oss"}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we just reuse PACKAGE_NAME?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I'll do that

}

# Checks that all directories & files are correctly installed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ load $BATS_UTILS/xpack.bash
setup() {
skip_not_tar_gz
export ESHOME=/tmp/elasticsearch
export ARCHIVE_NAME="elasticsearch"
export_elasticsearch_paths
export ESPLUGIN_COMMAND_USER=elasticsearch
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ load $BATS_UTILS/xpack.bash
setup() {
if [ $BATS_TEST_NUMBER == 1 ]; then
export PACKAGE_NAME="elasticsearch"
export ARCHIVE_NAME="elasticsearch"
clean_before_test
install

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ certificates="/tmp/certificates.zip"

setup() {
export PACKAGE_NAME="elasticsearch"
export ARCHIVE_NAME="elasticsearch"
if [ $BATS_TEST_NUMBER == 1 ]; then
clean_before_test
fi
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ load $BATS_UTILS/xpack.bash
setup() {
if [ $BATS_TEST_NUMBER == 1 ]; then
export PACKAGE_NAME="elasticsearch"
export ARCHIVE_NAME="elasticsearch"
clean_before_test
install

Expand Down