Skip to content

Commit 45cb32e

Browse files
committed
Update packaging tests to work with meta plugins (#28336)
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.
1 parent 0522218 commit 45cb32e

File tree

1 file changed

+16
-12
lines changed

1 file changed

+16
-12
lines changed

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

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
# specific language governing permissions and limitations
3131
# under the License.
3232

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

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

@@ -66,13 +64,6 @@ install_plugin() {
6664
fi
6765
}
6866

69-
install_jvm_plugin() {
70-
local name=$1
71-
local path="$2"
72-
install_plugin $name "$path" $3
73-
assert_file_exist "$ESPLUGINS/$name/$name"*".jar"
74-
}
75-
7667
# Remove a plugin and make sure its plugin directory is removed.
7768
remove_plugin() {
7869
local name=$1
@@ -95,7 +86,7 @@ remove_plugin() {
9586
# placements for non-site plugins.
9687
install_jvm_example() {
9788
local relativePath=${1:-$(readlink -m jvm-example-*.zip)}
98-
install_jvm_plugin jvm-example "$relativePath" $2
89+
install_plugin jvm-example "$relativePath" $2
9990

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

159-
install_jvm_plugin $full_name "$(readlink -m $full_name-*.zip)"
150+
install_plugin $full_name "$(readlink -m $full_name-*.zip)"
160151

161152
assert_module_or_plugin_directory "$ESPLUGINS/$full_name"
153+
assert_file_exist "$ESPLUGINS/$full_name/plugin-descriptor.properties"
154+
assert_file_exist "$ESPLUGINS/$full_name/$full_name"*".jar"
162155

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

172+
# Install a meta plugin
173+
# $1 - the plugin name
174+
# $@ - all remaining arguments are jars that must exist in the plugin's
175+
# installation directory
176+
install_meta_plugin() {
177+
local name=$1
178+
179+
install_plugin $name "$(readlink -m $name-*.zip)"
180+
assert_module_or_plugin_directory "$ESPLUGINS/$name"
181+
}
182+
179183
# Compare a list of plugin names to the plugins in the plugins pom and see if they are the same
180184
# $1 the file containing the list of plugins we want to compare to
181185
# $2 description of the source of the plugin list

0 commit comments

Comments
 (0)