diff --git a/qa/vagrant/src/test/resources/packaging/scripts/25_tar_plugins.bats b/qa/vagrant/src/test/resources/packaging/scripts/25_tar_plugins.bats index 8f55b1eb78c..552c404a3d6 120000 --- a/qa/vagrant/src/test/resources/packaging/scripts/25_tar_plugins.bats +++ b/qa/vagrant/src/test/resources/packaging/scripts/25_tar_plugins.bats @@ -1 +1 @@ -plugin_test_cases.bash \ No newline at end of file +module_and_plugin_test_cases.bash \ No newline at end of file diff --git a/qa/vagrant/src/test/resources/packaging/scripts/50_modules_and_plugins.bats b/qa/vagrant/src/test/resources/packaging/scripts/50_modules_and_plugins.bats new file mode 120000 index 00000000000..552c404a3d6 --- /dev/null +++ b/qa/vagrant/src/test/resources/packaging/scripts/50_modules_and_plugins.bats @@ -0,0 +1 @@ +module_and_plugin_test_cases.bash \ No newline at end of file diff --git a/qa/vagrant/src/test/resources/packaging/scripts/50_plugins.bats b/qa/vagrant/src/test/resources/packaging/scripts/50_plugins.bats deleted file mode 120000 index 8f55b1eb78c..00000000000 --- a/qa/vagrant/src/test/resources/packaging/scripts/50_plugins.bats +++ /dev/null @@ -1 +0,0 @@ -plugin_test_cases.bash \ No newline at end of file diff --git a/qa/vagrant/src/test/resources/packaging/scripts/plugin_test_cases.bash b/qa/vagrant/src/test/resources/packaging/scripts/module_and_plugin_test_cases.bash similarity index 91% rename from qa/vagrant/src/test/resources/packaging/scripts/plugin_test_cases.bash rename to qa/vagrant/src/test/resources/packaging/scripts/module_and_plugin_test_cases.bash index e829141def0..ed5d7d0cea1 100644 --- a/qa/vagrant/src/test/resources/packaging/scripts/plugin_test_cases.bash +++ b/qa/vagrant/src/test/resources/packaging/scripts/module_and_plugin_test_cases.bash @@ -33,13 +33,14 @@ ################################## # Common test cases for both tar and rpm/deb based plugin tests ################################## -# This file is symlinked to both 25_tar_plugins.bats and 50_plugins.bats so its +# This file is symlinked to both 25_tar_plugins.bats and 50_modules_and_plugins.bats so its # executed twice - once to test plugins using the tar distribution and once to # test files using the rpm distribution or the deb distribution, whichever the # system uses. # Load test utilities load packaging_test_utils +load modules load plugins setup() { @@ -219,16 +220,30 @@ fi install_and_check_plugin discovery ec2 aws-java-sdk-core-*.jar } -@test "[$GROUP] install lang-expression plugin" { - install_and_check_plugin lang expression +@test "[$GROUP] check ingest-grok module" { + check_module ingest-grok jcodings-*.jar joni-*.jar } -@test "[$GROUP] install lang-groovy plugin" { - install_and_check_plugin lang groovy +@test "[$GROUP] check lang-expression module" { + # we specify the version on the asm-5.0.4.jar so that the test does + # not spuriously pass if the jar is missing but the other asm jars + # are present + check_secure_module lang-expression antlr4-runtime-*.jar asm-5.0.4.jar asm-commons-*.jar asm-tree-*.jar lucene-expressions-*.jar } -@test "[$GROUP] install lang-painless plugin" { - install_and_check_plugin lang painless +@test "[$GROUP] check lang-groovy module" { + check_secure_module lang-groovy groovy-*-indy.jar +} + +@test "[$GROUP] check lang-mustache module" { + check_secure_module lang-mustache compiler-*.jar +} + +@test "[$GROUP] check lang-painless module" { + # we specify the version on the asm-5.0.4.jar so that the test does + # not spuriously pass if the jar is missing but the other asm jars + # are present + check_secure_module lang-painless antlr4-runtime-*.jar asm-5.0.4.jar asm-commons-*.jar asm-tree-*.jar } @test "[$GROUP] install javascript plugin" { @@ -247,6 +262,10 @@ fi install_and_check_plugin mapper murmur3 } +@test "[$GROUP] check reindex module" { + check_module reindex +} + @test "[$GROUP] install size mapper plugin" { install_and_check_plugin mapper size } @@ -321,18 +340,6 @@ fi remove_plugin discovery-ec2 } -@test "[$GROUP] remove lang-expression plugin" { - remove_plugin lang-expression -} - -@test "[$GROUP] remove lang-groovy plugin" { - remove_plugin lang-groovy -} - -@test "[$GROUP] remove lang-painless plugin" { - remove_plugin lang-painless -} - @test "[$GROUP] remove javascript plugin" { remove_plugin lang-javascript } diff --git a/qa/vagrant/src/test/resources/packaging/scripts/modules.bash b/qa/vagrant/src/test/resources/packaging/scripts/modules.bash new file mode 100644 index 00000000000..047bd38da92 --- /dev/null +++ b/qa/vagrant/src/test/resources/packaging/scripts/modules.bash @@ -0,0 +1,42 @@ +#!/bin/sh + +# This file contains some utilities to test the elasticsearch scripts, +# the .deb/.rpm packages and the SysV/Systemd scripts. + +# WARNING: This testing file must be executed as root and can +# dramatically change your system. It removes the 'elasticsearch' +# user/group and also many directories. Do not execute this file +# unless you know exactly what you are doing. + +# Licensed to Elasticsearch under one or more contributor +# license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright +# ownership. Elasticsearch licenses this file to you under +# the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +check_module() { + local name=$1 + shift + + for file in "$@"; do + assert_file_exist "$(readlink -m $ESMODULES/$name/$file)" + done + + assert_file_exist "$(readlink -m $ESMODULES/$name/$name-*.jar)" + assert_file_exist "$(readlink -m $ESMODULES/$name/plugin-descriptor.properties)" +} + +check_secure_module() { + check_module "$@" plugin-security.policy +} \ No newline at end of file diff --git a/qa/vagrant/src/test/resources/packaging/scripts/os_package.bash b/qa/vagrant/src/test/resources/packaging/scripts/os_package.bash index f48532cb3f3..f4b991e81ef 100644 --- a/qa/vagrant/src/test/resources/packaging/scripts/os_package.bash +++ b/qa/vagrant/src/test/resources/packaging/scripts/os_package.bash @@ -30,6 +30,7 @@ export_elasticsearch_paths() { export ESHOME="/usr/share/elasticsearch" export ESPLUGINS="$ESHOME/plugins" + export ESMODULES="$ESHOME/modules" export ESCONFIG="/etc/elasticsearch" export ESSCRIPTS="$ESCONFIG/scripts" export ESDATA="/var/lib/elasticsearch" @@ -82,6 +83,7 @@ verify_package_installation() { assert_file "$ESDATA" d elasticsearch elasticsearch 755 assert_file "$ESLOG" d elasticsearch elasticsearch 755 assert_file "$ESPLUGINS" d elasticsearch elasticsearch 755 + assert_file "$ESMODULES" d root root 755 assert_file "$ESPIDDIR" d elasticsearch elasticsearch 755 assert_file "$ESHOME/NOTICE.txt" f root root 644 assert_file "$ESHOME/README.textile" f root root 644 diff --git a/qa/vagrant/src/test/resources/packaging/scripts/tar.bash b/qa/vagrant/src/test/resources/packaging/scripts/tar.bash index f9bcc10525b..56b162cdefe 100644 --- a/qa/vagrant/src/test/resources/packaging/scripts/tar.bash +++ b/qa/vagrant/src/test/resources/packaging/scripts/tar.bash @@ -68,6 +68,7 @@ move_elasticsearch() { # Export some useful paths. export_elasticsearch_paths() { + export ESMODULES="$ESHOME/modules" export ESPLUGINS="$ESHOME/plugins" export ESCONFIG="$ESHOME/config" export ESSCRIPTS="$ESCONFIG/scripts"