Skip to content

Commit

Permalink
Update packaging tests to work with meta plugins (#28336)
Browse files Browse the repository at this point in the history
The current install_plugin() does not play well with meta plugins because 
it always checks for the plugin's descriptor file.

This commit changes the install_plugin() so that it only runs the install plugin 
command and lets the caller verify that the required files are correctly installed. 
It also adds a install_meta_plugin() function to install meta plugins.
  • Loading branch information
tlrx committed Jan 25, 2018
1 parent a57a0ae commit f4d0cf5
Showing 1 changed file with 16 additions and 12 deletions.
28 changes: 16 additions & 12 deletions qa/vagrant/src/test/resources/packaging/utils/plugins.bash
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
# specific language governing permissions and limitations
# under the License.

# Install a plugin an run all the common post installation tests.
# Install a plugin
install_plugin() {
local name=$1
local path="$2"
Expand All @@ -52,8 +52,6 @@ install_plugin() {
sudo -E -u $ESPLUGIN_COMMAND_USER bash -c "umask $umask && \"$ESHOME/bin/elasticsearch-plugin\" install -batch \"file://$path\""
fi

assert_file_exist "$ESPLUGINS/$name"
assert_file_exist "$ESPLUGINS/$name/plugin-descriptor.properties"
#check we did not accidentially create a log file as root as /usr/share/elasticsearch
assert_file_not_exist "/usr/share/elasticsearch/logs"

Expand All @@ -66,13 +64,6 @@ install_plugin() {
fi
}

install_jvm_plugin() {
local name=$1
local path="$2"
install_plugin $name "$path" $3
assert_file_exist "$ESPLUGINS/$name/$name"*".jar"
}

# Remove a plugin and make sure its plugin directory is removed.
remove_plugin() {
local name=$1
Expand All @@ -95,7 +86,7 @@ remove_plugin() {
# placements for non-site plugins.
install_jvm_example() {
local relativePath=${1:-$(readlink -m jvm-example-*.zip)}
install_jvm_plugin jvm-example "$relativePath" $2
install_plugin jvm-example "$relativePath" $2

bin_user=$(find "$ESHOME/bin" -maxdepth 0 -printf "%u")
bin_owner=$(find "$ESHOME/bin" -maxdepth 0 -printf "%g")
Expand Down Expand Up @@ -156,9 +147,11 @@ install_and_check_plugin() {
local full_name="$prefix-$name"
fi

install_jvm_plugin $full_name "$(readlink -m $full_name-*.zip)"
install_plugin $full_name "$(readlink -m $full_name-*.zip)"

assert_module_or_plugin_directory "$ESPLUGINS/$full_name"
assert_file_exist "$ESPLUGINS/$full_name/plugin-descriptor.properties"
assert_file_exist "$ESPLUGINS/$full_name/$full_name"*".jar"

# analysis plugins have a corresponding analyzers jar
if [ $prefix == 'analysis' ]; then
Expand All @@ -176,6 +169,17 @@ install_and_check_plugin() {
done
}

# Install a meta plugin
# $1 - the plugin name
# $@ - all remaining arguments are jars that must exist in the plugin's
# installation directory
install_meta_plugin() {
local name=$1

install_plugin $name "$(readlink -m $name-*.zip)"
assert_module_or_plugin_directory "$ESPLUGINS/$name"
}

# Compare a list of plugin names to the plugins in the plugins pom and see if they are the same
# $1 the file containing the list of plugins we want to compare to
# $2 description of the source of the plugin list
Expand Down

0 comments on commit f4d0cf5

Please sign in to comment.