diff --git a/Vagrantfile b/Vagrantfile index c6698725c2a..53e7e3da7ca 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -150,7 +150,7 @@ export TAR=/elasticsearch/distribution/tar/target/releases export RPM=/elasticsearch/distribution/rpm/target/releases export DEB=/elasticsearch/distribution/deb/target/releases export TESTROOT=/elasticsearch/qa/vagrant/target/testroot -export BATS=/elasticsearch/qa/vagrant/src/test/resources/packaging/scripts/ +export BATS=/elasticsearch/qa/vagrant/src/test/resources/packaging/scripts VARS SHELL end diff --git a/qa/vagrant/pom.xml b/qa/vagrant/pom.xml index f9304dd4ccd..26636be5854 100644 --- a/qa/vagrant/pom.xml +++ b/qa/vagrant/pom.xml @@ -92,6 +92,12 @@ ${elasticsearch.version} deb + + org.elasticsearch.plugin + elasticsearch-jvm-example + ${elasticsearch.version} + zip + 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 0ec12eca2e9..efc0c2e7d73 100644 --- a/qa/vagrant/src/test/resources/packaging/scripts/25_tar_plugins.bats +++ b/qa/vagrant/src/test/resources/packaging/scripts/25_tar_plugins.bats @@ -35,23 +35,12 @@ load packaging_test_utils setup() { # Cleans everything for every test execution clean_before_test - - # Download Shield - SHIELD_ZIP="$PWD/shield.zip" - - if [ "$BATS_TEST_NUMBER" -eq 1 ]; then - if [ ! -e "$SHIELD_ZIP" ]; then - wget --quiet -O "$SHIELD_ZIP" "http://download.elasticsearch.org/elasticsearch/shield/shield-latest.zip" - fi - fi } ################################## # Install plugins with a tar archive ################################## -@test "[TAR] install shield plugin" { - skip "awaits public release of shield for 2.0" - +@test "[TAR] install jvm-example plugin" { # Install the archive install_archive @@ -59,40 +48,35 @@ setup() { verify_archive_installation # Checks that plugin archive is available - [ -e "$SHIELD_ZIP" ] + [ -e "$EXAMPLE_PLUGIN_ZIP" ] - # Install Shield - run /tmp/elasticsearch/bin/plugin install elasticsearch/shield/latest -u "file://$SHIELD_ZIP" + # Install jvm-example + run /tmp/elasticsearch/bin/plugin install jvm-example -u "file://$EXAMPLE_PLUGIN_ZIP" [ "$status" -eq 0 ] - # Checks that Shield is correctly installed - assert_file_exist "/tmp/elasticsearch/bin/shield" - assert_file_exist "/tmp/elasticsearch/bin/shield/esusers" - assert_file_exist "/tmp/elasticsearch/bin/shield/syskeygen" - assert_file_exist "/tmp/elasticsearch/config/shield" - assert_file_exist "/tmp/elasticsearch/config/shield/role_mapping.yml" - assert_file_exist "/tmp/elasticsearch/config/shield/roles.yml" - assert_file_exist "/tmp/elasticsearch/config/shield/users" - assert_file_exist "/tmp/elasticsearch/config/shield/users_roles" - assert_file_exist "/tmp/elasticsearch/plugins/shield" + # Checks that the plugin is correctly installed + assert_file_exist "/tmp/elasticsearch/bin/jvm-example" + assert_file_exist "/tmp/elasticsearch/bin/jvm-example/test" + assert_file_exist "/tmp/elasticsearch/config/jvm-example" + assert_file_exist "/tmp/elasticsearch/config/jvm-example/example.yaml" + assert_file_exist "/tmp/elasticsearch/plugins/jvm-example" + assert_file_exist "/tmp/elasticsearch/plugins/jvm-example/plugin-descriptor.properties" + assert_file_exist "/tmp/elasticsearch/plugins/jvm-example/elasticsearch-jvm-example-"*".jar" + echo "Running jvm-example's bin script...." + /tmp/elasticsearch/bin/jvm-example/test | grep test # Remove the plugin - run /tmp/elasticsearch/bin/plugin remove elasticsearch/shield/latest + run /tmp/elasticsearch/bin/plugin remove jvm-example [ "$status" -eq 0 ] # Checks that the plugin is correctly removed - assert_file_not_exist "/tmp/elasticsearch/bin/shield" - assert_file_exist "/tmp/elasticsearch/config/shield" - assert_file_exist "/tmp/elasticsearch/config/shield/role_mapping.yml" - assert_file_exist "/tmp/elasticsearch/config/shield/roles.yml" - assert_file_exist "/tmp/elasticsearch/config/shield/users" - assert_file_exist "/tmp/elasticsearch/config/shield/users_roles" - assert_file_not_exist "/tmp/elasticsearch/plugins/shield" + assert_file_not_exist "/tmp/elasticsearch/bin/jvm-example" + assert_file_exist "/tmp/elasticsearch/config/jvm-example" + assert_file_exist "/tmp/elasticsearch/config/jvm-example/example.yaml" + assert_file_not_exist "/tmp/elasticsearch/plugins/jvm-example" } -@test "[TAR] install shield plugin with a custom path.plugins" { - skip "awaits public release of shield for 2.0" - +@test "[TAR] install jvm-example plugin with a custom path.plugins" { # Install the archive install_archive @@ -109,44 +93,37 @@ setup() { [ "$status" -eq 0 ] # Checks that plugin archive is available - [ -e "$SHIELD_ZIP" ] + [ -e "$EXAMPLE_PLUGIN_ZIP" ] - # Install Shield - run /tmp/elasticsearch/bin/plugin install elasticsearch/shield/latest -u "file://$SHIELD_ZIP" + # Install jvm-example + run /tmp/elasticsearch/bin/plugin install jvm-example -u "file://$EXAMPLE_PLUGIN_ZIP" [ "$status" -eq 0 ] - # Checks that Shield is correctly installed - assert_file_exist "/tmp/elasticsearch/bin/shield" - assert_file_exist "/tmp/elasticsearch/bin/shield/esusers" - assert_file_exist "/tmp/elasticsearch/bin/shield/syskeygen" - assert_file_exist "/tmp/elasticsearch/config/shield" - assert_file_exist "/tmp/elasticsearch/config/shield/role_mapping.yml" - assert_file_exist "/tmp/elasticsearch/config/shield/roles.yml" - assert_file_exist "/tmp/elasticsearch/config/shield/users" - assert_file_exist "/tmp/elasticsearch/config/shield/users_roles" - assert_file_exist "$TEMP_PLUGINS_DIR/shield" + # Checks that the plugin is correctly installed + assert_file_exist "/tmp/elasticsearch/bin/jvm-example" + assert_file_exist "/tmp/elasticsearch/bin/jvm-example/test" + assert_file_exist "/tmp/elasticsearch/config/jvm-example" + assert_file_exist "/tmp/elasticsearch/config/jvm-example/example.yaml" + assert_file_exist "$TEMP_PLUGINS_DIR/jvm-example" + assert_file_exist "$TEMP_PLUGINS_DIR/jvm-example/plugin-descriptor.properties" + assert_file_exist "$TEMP_PLUGINS_DIR/jvm-example/elasticsearch-jvm-example-"*".jar" # Remove the plugin - run /tmp/elasticsearch/bin/plugin remove elasticsearch/shield/latest + run /tmp/elasticsearch/bin/plugin remove jvm-example [ "$status" -eq 0 ] # Checks that the plugin is correctly removed - assert_file_not_exist "/tmp/elasticsearch/bin/shield" - assert_file_exist "/tmp/elasticsearch/config/shield" - assert_file_exist "/tmp/elasticsearch/config/shield/role_mapping.yml" - assert_file_exist "/tmp/elasticsearch/config/shield/roles.yml" - assert_file_exist "/tmp/elasticsearch/config/shield/users" - assert_file_exist "/tmp/elasticsearch/config/shield/users_roles" - assert_file_not_exist "$TEMP_PLUGINS_DIR/shield" + assert_file_not_exist "/tmp/elasticsearch/bin/jvm-example" + assert_file_exist "/tmp/elasticsearch/config/jvm-example" + assert_file_exist "/tmp/elasticsearch/config/jvm-example/example.yaml" + assert_file_not_exist "$TEMP_PLUGINS_DIR/jvm-example" # Delete the custom plugins directory run rm -rf "$TEMP_PLUGINS_DIR" [ "$status" -eq 0 ] } -@test "[TAR] install shield plugin with a custom CONFIG_DIR" { - skip "awaits public release of shield for 2.0" - +@test "[TAR] install jvm-example plugin with a custom CONFIG_DIR" { # Install the archive install_archive @@ -166,44 +143,37 @@ setup() { assert_file_exist "$TEMP_CONFIG_DIR/elasticsearch.yml" # Checks that plugin archive is available - [ -e "$SHIELD_ZIP" ] + [ -e "$EXAMPLE_PLUGIN_ZIP" ] - # Install Shield with the CONF_DIR environment variable - run env "CONF_DIR=$TEMP_CONFIG_DIR" /tmp/elasticsearch/bin/plugin install "elasticsearch/shield/latest" -u "file://$SHIELD_ZIP" + # Install jvm-example with the CONF_DIR environment variable + run env "CONF_DIR=$TEMP_CONFIG_DIR" /tmp/elasticsearch/bin/plugin install jvm-example -u "file://$EXAMPLE_PLUGIN_ZIP" [ "$status" -eq 0 ] - # Checks that Shield is correctly installed - assert_file_exist "/tmp/elasticsearch/bin/shield" - assert_file_exist "/tmp/elasticsearch/bin/shield/esusers" - assert_file_exist "/tmp/elasticsearch/bin/shield/syskeygen" - assert_file_exist "$TEMP_CONFIG_DIR/shield" - assert_file_exist "$TEMP_CONFIG_DIR/shield/role_mapping.yml" - assert_file_exist "$TEMP_CONFIG_DIR/shield/roles.yml" - assert_file_exist "$TEMP_CONFIG_DIR/shield/users" - assert_file_exist "$TEMP_CONFIG_DIR/shield/users_roles" - assert_file_exist "/tmp/elasticsearch/plugins/shield" + # Checks that jvm-example is correctly installed + assert_file_exist "/tmp/elasticsearch/bin/jvm-example" + assert_file_exist "/tmp/elasticsearch/bin/jvm-example/test" + assert_file_exist "$TEMP_CONFIG_DIR/jvm-example" + assert_file_exist "$TEMP_CONFIG_DIR/jvm-example/example.yaml" + assert_file_exist "/tmp/elasticsearch/plugins/jvm-example" + assert_file_exist "/tmp/elasticsearch/plugins/jvm-example/plugin-descriptor.properties" + assert_file_exist "/tmp/elasticsearch/plugins/jvm-example/elasticsearch-jvm-example-"*".jar" # Remove the plugin - run /tmp/elasticsearch/bin/plugin remove elasticsearch/shield/latest + run /tmp/elasticsearch/bin/plugin remove jvm-example [ "$status" -eq 0 ] # Checks that the plugin is correctly removed - assert_file_not_exist "/tmp/elasticsearch/bin/shield" - assert_file_exist "$TEMP_CONFIG_DIR/shield" - assert_file_exist "$TEMP_CONFIG_DIR/shield/role_mapping.yml" - assert_file_exist "$TEMP_CONFIG_DIR/shield/roles.yml" - assert_file_exist "$TEMP_CONFIG_DIR/shield/users" - assert_file_exist "$TEMP_CONFIG_DIR/shield/users_roles" - assert_file_not_exist "/tmp/elasticsearch/plugins/shield" + assert_file_not_exist "/tmp/elasticsearch/bin/jvm-example" + assert_file_exist "$TEMP_CONFIG_DIR/jvm-example" + assert_file_exist "$TEMP_CONFIG_DIR/jvm-example/example.yaml" + assert_file_not_exist "/tmp/elasticsearch/plugins/jvm-example" # Delete the custom plugins directory run rm -rf "$TEMP_CONFIG_DIR" [ "$status" -eq 0 ] } -@test "[TAR] install shield plugin with a custom ES_JAVA_OPTS" { - skip "awaits public release of shield for 2.0" - +@test "[TAR] install jvm-example plugin with a custom ES_JAVA_OPTS" { # Install the archive install_archive @@ -227,44 +197,37 @@ setup() { [ "$status" -eq 0 ] # Checks that plugin archive is available - [ -e "$SHIELD_ZIP" ] + [ -e "$EXAMPLE_PLUGIN_ZIP" ] - # Install Shield - run /tmp/elasticsearch/bin/plugin install elasticsearch/shield/latest -u "file://$SHIELD_ZIP" + # Install jvm-example + run /tmp/elasticsearch/bin/plugin install jvm-example -u "file://$EXAMPLE_PLUGIN_ZIP" [ "$status" -eq 0 ] - # Checks that Shield is correctly installed - assert_file_exist "/tmp/elasticsearch/bin/shield" - assert_file_exist "/tmp/elasticsearch/bin/shield/esusers" - assert_file_exist "/tmp/elasticsearch/bin/shield/syskeygen" - assert_file_exist "$TEMP_CONFIG_DIR/shield" - assert_file_exist "$TEMP_CONFIG_DIR/shield/role_mapping.yml" - assert_file_exist "$TEMP_CONFIG_DIR/shield/roles.yml" - assert_file_exist "$TEMP_CONFIG_DIR/shield/users" - assert_file_exist "$TEMP_CONFIG_DIR/shield/users_roles" - assert_file_exist "/tmp/elasticsearch/plugins/shield" + # Checks that jvm-example is correctly installed + assert_file_exist "/tmp/elasticsearch/bin/jvm-example" + assert_file_exist "/tmp/elasticsearch/bin/jvm-example/test" + assert_file_exist "$TEMP_CONFIG_DIR/jvm-example" + assert_file_exist "$TEMP_CONFIG_DIR/jvm-example/example.yaml" + assert_file_exist "/tmp/elasticsearch/plugins/jvm-example" + assert_file_exist "/tmp/elasticsearch/plugins/jvm-example/plugin-descriptor.properties" + assert_file_exist "/tmp/elasticsearch/plugins/jvm-example/elasticsearch-jvm-example-"*".jar" # Remove the plugin - run /tmp/elasticsearch/bin/plugin remove elasticsearch/shield/latest + run /tmp/elasticsearch/bin/plugin remove jvm-example [ "$status" -eq 0 ] # Checks that the plugin is correctly removed - assert_file_not_exist "/tmp/elasticsearch/bin/shield" - assert_file_exist "$TEMP_CONFIG_DIR/shield" - assert_file_exist "$TEMP_CONFIG_DIR/shield/role_mapping.yml" - assert_file_exist "$TEMP_CONFIG_DIR/shield/roles.yml" - assert_file_exist "$TEMP_CONFIG_DIR/shield/users" - assert_file_exist "$TEMP_CONFIG_DIR/shield/users_roles" - assert_file_not_exist "/tmp/elasticsearch/plugins/shield" + assert_file_not_exist "/tmp/elasticsearch/bin/jvm-example" + assert_file_exist "$TEMP_CONFIG_DIR/jvm-example" + assert_file_exist "$TEMP_CONFIG_DIR/jvm-example/example.yaml" + assert_file_not_exist "/tmp/elasticsearch/plugins/jvm-example" # Delete the custom plugins directory run rm -rf "$TEMP_CONFIG_DIR" [ "$status" -eq 0 ] } -@test "[TAR] install shield plugin to elasticsearch directory with a space" { - skip "awaits public release of shield for 2.0" - +@test "[TAR] install jvm-example plugin to elasticsearch directory with a space" { export ES_DIR="/tmp/elastic search" # Install the archive @@ -278,44 +241,37 @@ setup() { mv /tmp/elasticsearch "$ES_DIR" # Checks that plugin archive is available - [ -e "$SHIELD_ZIP" ] + [ -e "$EXAMPLE_PLUGIN_ZIP" ] - # Install Shield - run "$ES_DIR/bin/plugin" install elasticsearch/shield/latest -u "file://$SHIELD_ZIP" + # Install jvm-example + run "$ES_DIR/bin/plugin" install jvm-example -u "file://$EXAMPLE_PLUGIN_ZIP" [ "$status" -eq 0 ] - # Checks that Shield is correctly installed - assert_file_exist "$ES_DIR/bin/shield" - assert_file_exist "$ES_DIR/bin/shield/esusers" - assert_file_exist "$ES_DIR/bin/shield/syskeygen" - assert_file_exist "$ES_DIR/config/shield" - assert_file_exist "$ES_DIR/config/shield/role_mapping.yml" - assert_file_exist "$ES_DIR/config/shield/roles.yml" - assert_file_exist "$ES_DIR/config/shield/users" - assert_file_exist "$ES_DIR/config/shield/users_roles" - assert_file_exist "$ES_DIR/plugins/shield" + # Checks that jvm-example is correctly installed + assert_file_exist "$ES_DIR/bin/jvm-example" + assert_file_exist "$ES_DIR/bin/jvm-example/test" + assert_file_exist "$ES_DIR/config/jvm-example" + assert_file_exist "$ES_DIR/config/jvm-example/example.yaml" + assert_file_exist "$ES_DIR/plugins/jvm-example" + assert_file_exist "$ES_DIR/plugins/jvm-example/plugin-descriptor.properties" + assert_file_exist "$ES_DIR/plugins/jvm-example/elasticsearch-jvm-example-"*".jar" # Remove the plugin - run "$ES_DIR/bin/plugin" remove elasticsearch/shield/latest + run "$ES_DIR/bin/plugin" remove jvm-example [ "$status" -eq 0 ] # Checks that the plugin is correctly removed - assert_file_not_exist "$ES_DIR/bin/shield" - assert_file_exist "$ES_DIR/config/shield" - assert_file_exist "$ES_DIR/config/shield/role_mapping.yml" - assert_file_exist "$ES_DIR/config/shield/roles.yml" - assert_file_exist "$ES_DIR/config/shield/users" - assert_file_exist "$ES_DIR/config/shield/users_roles" - assert_file_not_exist "$ES_DIR/plugins/shield" + assert_file_not_exist "$ES_DIR/bin/jvm-example" + assert_file_exist "$ES_DIR/config/jvm-example" + assert_file_exist "$ES_DIR/config/jvm-example/example.yaml" + assert_file_not_exist "$ES_DIR/plugins/jvm-example" #Cleanup our temporary Elasticsearch installation rm -rf "$ES_DIR" } -@test "[TAR] install shield plugin from a directory with a space" { - skip "awaits public release of shield for 2.0" - - export SHIELD_ZIP_WITH_SPACE="/tmp/plugins with space/shield.zip" +@test "[TAR] install jvm-example plugin from a directory with a space" { + export EXAMPLE_PLUGIN_ZIP_WITH_SPACE="/tmp/plugins with space/jvm-example.zip" # Install the archive install_archive @@ -324,41 +280,36 @@ setup() { verify_archive_installation # Checks that plugin archive is available - [ -e "$SHIELD_ZIP" ] + [ -e "$EXAMPLE_PLUGIN_ZIP" ] - # Copy the shield plugin to a directory with a space in it - rm -f "$SHIELD_ZIP_WITH_SPACE" - mkdir -p "$(dirname "$SHIELD_ZIP_WITH_SPACE")" - cp $SHIELD_ZIP "$SHIELD_ZIP_WITH_SPACE" + # Copy the jvm-example plugin to a directory with a space in it + rm -f "$EXAMPLE_PLUGIN_ZIP_WITH_SPACE" + mkdir -p "$(dirname "$EXAMPLE_PLUGIN_ZIP_WITH_SPACE")" + cp $EXAMPLE_PLUGIN_ZIP "$EXAMPLE_PLUGIN_ZIP_WITH_SPACE" - # Install Shield - run /tmp/elasticsearch/bin/plugin install elasticsearch/shield/latest -u "file://$SHIELD_ZIP_WITH_SPACE" + # Install jvm-example + run /tmp/elasticsearch/bin/plugin install jvm-example -u "file://$EXAMPLE_PLUGIN_ZIP_WITH_SPACE" [ "$status" -eq 0 ] - # Checks that Shield is correctly installed - assert_file_exist "/tmp/elasticsearch/bin/shield" - assert_file_exist "/tmp/elasticsearch/bin/shield/esusers" - assert_file_exist "/tmp/elasticsearch/bin/shield/syskeygen" - assert_file_exist "/tmp/elasticsearch/config/shield" - assert_file_exist "/tmp/elasticsearch/config/shield/role_mapping.yml" - assert_file_exist "/tmp/elasticsearch/config/shield/roles.yml" - assert_file_exist "/tmp/elasticsearch/config/shield/users" - assert_file_exist "/tmp/elasticsearch/config/shield/users_roles" - assert_file_exist "/tmp/elasticsearch/plugins/shield" + # Checks that the plugin is correctly installed + assert_file_exist "/tmp/elasticsearch/bin/jvm-example" + assert_file_exist "/tmp/elasticsearch/bin/jvm-example/test" + assert_file_exist "/tmp/elasticsearch/config/jvm-example" + assert_file_exist "/tmp/elasticsearch/config/jvm-example/example.yaml" + assert_file_exist "/tmp/elasticsearch/plugins/jvm-example" + assert_file_exist "/tmp/elasticsearch/plugins/jvm-example/plugin-descriptor.properties" + assert_file_exist "/tmp/elasticsearch/plugins/jvm-example/elasticsearch-jvm-example-"*".jar" # Remove the plugin - run /tmp/elasticsearch/bin/plugin remove elasticsearch/shield/latest + run /tmp/elasticsearch/bin/plugin remove jvm-example [ "$status" -eq 0 ] # Checks that the plugin is correctly removed - assert_file_not_exist "/tmp/elasticsearch/bin/shield" - assert_file_exist "/tmp/elasticsearch/config/shield" - assert_file_exist "/tmp/elasticsearch/config/shield/role_mapping.yml" - assert_file_exist "/tmp/elasticsearch/config/shield/roles.yml" - assert_file_exist "/tmp/elasticsearch/config/shield/users" - assert_file_exist "/tmp/elasticsearch/config/shield/users_roles" - assert_file_not_exist "/tmp/elasticsearch/plugins/shield" + assert_file_not_exist "/tmp/elasticsearch/bin/jvm-example" + assert_file_exist "/tmp/elasticsearch/config/jvm-example" + assert_file_exist "/tmp/elasticsearch/config/jvm-example/example.yaml" + assert_file_not_exist "/tmp/elasticsearch/plugins/jvm-example" #Cleanup our plugin directory with a space - rm -rf "$SHIELD_ZIP_WITH_SPACE" + rm -rf "$EXAMPLE_PLUGIN_ZIP_WITH_SPACE" } diff --git a/qa/vagrant/src/test/resources/packaging/scripts/50_plugins.bats b/qa/vagrant/src/test/resources/packaging/scripts/50_plugins.bats index 99f2be98982..c739296479d 100644 --- a/qa/vagrant/src/test/resources/packaging/scripts/50_plugins.bats +++ b/qa/vagrant/src/test/resources/packaging/scripts/50_plugins.bats @@ -36,15 +36,6 @@ load packaging_test_utils setup() { # Cleans everything for every test execution clean_before_test - - # Download Shield - SHIELD_ZIP="$PWD/shield.zip" - - if [ "$BATS_TEST_NUMBER" -eq 1 ]; then - if [ ! -e "$SHIELD_ZIP" ]; then - wget --quiet -O "$SHIELD_ZIP" "http://download.elasticsearch.org/elasticsearch/shield/shield-latest.zip" - fi - fi } # Install a deb or rpm package @@ -62,9 +53,7 @@ install_package() { ################################## # Install plugins with DEB/RPM package ################################## -@test "[PLUGINS] install shield plugin" { - skip "awaits public release of shield for 2.0" - +@test "[PLUGINS] install jvm-example plugin" { # Install the package install_package @@ -72,40 +61,33 @@ install_package() { verify_package_installation # Checks that plugin archive is available - [ -e "$SHIELD_ZIP" ] + [ -e "$EXAMPLE_PLUGIN_ZIP" ] - # Install Shield - run /usr/share/elasticsearch/bin/plugin install elasticsearch/shield/latest -u "file://$SHIELD_ZIP" + # Install jvm-example + run /usr/share/elasticsearch/bin/plugin install jvm-example -u "file://$EXAMPLE_PLUGIN_ZIP" [ "$status" -eq 0 ] - # Checks that Shield is correctly installed - assert_file_exist "/usr/share/elasticsearch/bin/shield" - assert_file_exist "/usr/share/elasticsearch/bin/shield/esusers" - assert_file_exist "/usr/share/elasticsearch/bin/shield/syskeygen" - assert_file_exist "/etc/elasticsearch/shield" - assert_file_exist "/etc/elasticsearch/shield/role_mapping.yml" - assert_file_exist "/etc/elasticsearch/shield/roles.yml" - assert_file_exist "/etc/elasticsearch/shield/users" - assert_file_exist "/etc/elasticsearch/shield/users_roles" - assert_file_exist "/usr/share/elasticsearch/plugins/shield" + # Checks that jvm-example is correctly installed + assert_file_exist "/usr/share/elasticsearch/bin/jvm-example" + assert_file_exist "/usr/share/elasticsearch/bin/jvm-example/test" + assert_file_exist "/etc/elasticsearch/jvm-example" + assert_file_exist "/etc/elasticsearch/jvm-example/example.yaml" + assert_file_exist "/usr/share/elasticsearch/plugins/jvm-example" + assert_file_exist "/usr/share/elasticsearch/plugins/jvm-example/plugin-descriptor.properties" + assert_file_exist "/usr/share/elasticsearch/plugins/jvm-example/elasticsearch-jvm-example-"*".jar" # Remove the plugin - run /usr/share/elasticsearch/bin/plugin remove elasticsearch/shield/latest + run /usr/share/elasticsearch/bin/plugin remove jvm-example [ "$status" -eq 0 ] # Checks that the plugin is correctly removed - assert_file_not_exist "/usr/share/elasticsearch/bin/shield" - assert_file_exist "/etc/elasticsearch/shield" - assert_file_exist "/etc/elasticsearch/shield/role_mapping.yml" - assert_file_exist "/etc/elasticsearch/shield/roles.yml" - assert_file_exist "/etc/elasticsearch/shield/users" - assert_file_exist "/etc/elasticsearch/shield/users_roles" - assert_file_not_exist "/usr/share/elasticsearch/plugins/shield" + assert_file_not_exist "/usr/share/elasticsearch/bin/jvm-example" + assert_file_exist "/etc/elasticsearch/jvm-example" + assert_file_exist "/etc/elasticsearch/jvm-example/example.yaml" + assert_file_not_exist "/usr/share/elasticsearch/plugins/jvm-example" } -@test "[PLUGINS] install shield plugin with a custom path.plugins" { - skip "awaits public release of shield for 2.0" - +@test "[PLUGINS] install jvm-example plugin with a custom path.plugins" { # Install the package install_package @@ -126,44 +108,38 @@ install_package() { [ "$status" -eq 0 ] # Checks that plugin archive is available - [ -e "$SHIELD_ZIP" ] + [ -e "$EXAMPLE_PLUGIN_ZIP" ] - # Install Shield - run /usr/share/elasticsearch/bin/plugin install elasticsearch/shield/latest -u "file://$SHIELD_ZIP" + # Install jvm-example + run /usr/share/elasticsearch/bin/plugin install jvm-example -u "file://$EXAMPLE_PLUGIN_ZIP" [ "$status" -eq 0 ] - # Checks that Shield is correctly installed - assert_file_exist "/usr/share/elasticsearch/bin/shield" - assert_file_exist "/usr/share/elasticsearch/bin/shield/esusers" - assert_file_exist "/usr/share/elasticsearch/bin/shield/syskeygen" - assert_file_exist "/etc/elasticsearch/shield" - assert_file_exist "/etc/elasticsearch/shield/role_mapping.yml" - assert_file_exist "/etc/elasticsearch/shield/roles.yml" - assert_file_exist "/etc/elasticsearch/shield/users" - assert_file_exist "/etc/elasticsearch/shield/users_roles" - assert_file_exist "$TEMP_PLUGINS_DIR/shield" + # Checks that jvm-example is correctly installed + assert_file_exist "/usr/share/elasticsearch/bin/jvm-example" + assert_file_exist "/usr/share/elasticsearch/bin/jvm-example/test" + assert_file_exist "/etc/elasticsearch/jvm-example" + assert_file_exist "/etc/elasticsearch/jvm-example/example.yaml" + assert_file_exist "$TEMP_PLUGINS_DIR/jvm-example" + assert_file_exist "$TEMP_PLUGINS_DIR/jvm-example/plugin-descriptor.properties" + assert_file_exist "$TEMP_PLUGINS_DIR/jvm-example/elasticsearch-jvm-example-"*".jar" + # Remove the plugin - run /usr/share/elasticsearch/bin/plugin remove elasticsearch/shield/latest + run /usr/share/elasticsearch/bin/plugin remove jvm-example [ "$status" -eq 0 ] # Checks that the plugin is correctly removed - assert_file_not_exist "/usr/share/elasticsearch/bin/shield" - assert_file_exist "/etc/elasticsearch/shield" - assert_file_exist "/etc/elasticsearch/shield/role_mapping.yml" - assert_file_exist "/etc/elasticsearch/shield/roles.yml" - assert_file_exist "/etc/elasticsearch/shield/users" - assert_file_exist "/etc/elasticsearch/shield/users_roles" - assert_file_not_exist "$TEMP_PLUGINS_DIR/shield" + assert_file_not_exist "/usr/share/elasticsearch/bin/jvm-example" + assert_file_exist "/etc/elasticsearch/jvm-example" + assert_file_exist "/etc/elasticsearch/jvm-example/example.yaml" + assert_file_not_exist "$TEMP_PLUGINS_DIR/jvm-example" # Delete the custom plugins directory run rm -rf "$TEMP_PLUGINS_DIR" [ "$status" -eq 0 ] } -@test "[PLUGINS] install shield plugin with a custom CONFIG_DIR" { - skip "awaits public release of shield for 2.0" - +@test "[PLUGINS] install jvm-example plugin with a custom CONFIG_DIR" { # Install the package install_package @@ -194,44 +170,37 @@ install_package() { [ "$status" -eq 0 ] # Checks that plugin archive is available - [ -e "$SHIELD_ZIP" ] + [ -e "$EXAMPLE_PLUGIN_ZIP" ] - # Install Shield - run /usr/share/elasticsearch/bin/plugin install elasticsearch/shield/latest -u "file://$SHIELD_ZIP" + # Install jvm-exampel + run /usr/share/elasticsearch/bin/plugin install jvm-example -u "file://$EXAMPLE_PLUGIN_ZIP" [ "$status" -eq 0 ] - # Checks that Shield is correctly installed - assert_file_exist "/usr/share/elasticsearch/bin/shield" - assert_file_exist "/usr/share/elasticsearch/bin/shield/esusers" - assert_file_exist "/usr/share/elasticsearch/bin/shield/syskeygen" - assert_file_exist "$TEMP_CONFIG_DIR/shield" - assert_file_exist "$TEMP_CONFIG_DIR/shield/role_mapping.yml" - assert_file_exist "$TEMP_CONFIG_DIR/shield/roles.yml" - assert_file_exist "$TEMP_CONFIG_DIR/shield/users" - assert_file_exist "/$TEMP_CONFIG_DIR/shield/users_roles" - assert_file_exist "/usr/share/elasticsearch/plugins/shield" + # Checks that jvm-example is correctly installed + assert_file_exist "/usr/share/elasticsearch/bin/jvm-example" + assert_file_exist "/usr/share/elasticsearch/bin/jvm-example/test" + assert_file_exist "$TEMP_CONFIG_DIR/jvm-example" + assert_file_exist "$TEMP_CONFIG_DIR/jvm-example/example.yaml" + assert_file_exist "/usr/share/elasticsearch/plugins/jvm-example" + assert_file_exist "/usr/share/elasticsearch/plugins/jvm-example/plugin-descriptor.properties" + assert_file_exist "/usr/share/elasticsearch/plugins/jvm-example/elasticsearch-jvm-example-"*".jar" # Remove the plugin - run /usr/share/elasticsearch/bin/plugin remove elasticsearch/shield/latest + run /usr/share/elasticsearch/bin/plugin remove jvm-example [ "$status" -eq 0 ] # Checks that the plugin is correctly removed - assert_file_not_exist "/usr/share/elasticsearch/bin/shield" - assert_file_exist "$TEMP_CONFIG_DIR/shield" - assert_file_exist "$TEMP_CONFIG_DIR/shield/role_mapping.yml" - assert_file_exist "$TEMP_CONFIG_DIR/shield/roles.yml" - assert_file_exist "$TEMP_CONFIG_DIR/shield/users" - assert_file_exist "$TEMP_CONFIG_DIR/shield/users_roles" - assert_file_not_exist "/tmp/elasticsearch/plugins/shield" + assert_file_not_exist "/usr/share/elasticsearch/bin/jvm-example" + assert_file_exist "$TEMP_CONFIG_DIR/jvm-example" + assert_file_exist "$TEMP_CONFIG_DIR/jvm-example/example.yaml" + assert_file_not_exist "/usr/share/elasticsearch/plugins/jvm-example" # Delete the custom plugins directory run rm -rf "$TEMP_CONFIG_DIR" [ "$status" -eq 0 ] } -@test "[PLUGINS] install shield plugin with a custom ES_JAVA_OPTS" { - skip "awaits public release of shield for 2.0" - +@test "[PLUGINS] install jvm-example plugin with a custom ES_JAVA_OPTS" { # Install the package install_package @@ -259,35 +228,30 @@ install_package() { [ "$status" -eq 0 ] # Checks that plugin archive is available - [ -e "$SHIELD_ZIP" ] + [ -e "$EXAMPLE_PLUGIN_ZIP" ] - # Install Shield - run /usr/share/elasticsearch/bin/plugin install elasticsearch/shield/latest -u "file://$SHIELD_ZIP" + # Install jvm-example + run /usr/share/elasticsearch/bin/plugin install jvm-example -u "file://$EXAMPLE_PLUGIN_ZIP" [ "$status" -eq 0 ] - # Checks that Shield is correctly installed - assert_file_exist "/usr/share/elasticsearch/bin/shield" - assert_file_exist "/usr/share/elasticsearch/bin/shield/esusers" - assert_file_exist "/usr/share/elasticsearch/bin/shield/syskeygen" - assert_file_exist "$TEMP_CONFIG_DIR/shield" - assert_file_exist "$TEMP_CONFIG_DIR/shield/role_mapping.yml" - assert_file_exist "$TEMP_CONFIG_DIR/shield/roles.yml" - assert_file_exist "$TEMP_CONFIG_DIR/shield/users" - assert_file_exist "$TEMP_CONFIG_DIR/shield/users_roles" - assert_file_exist "/usr/share/elasticsearch/plugins/shield" + # Checks that jvm-example is correctly installed + assert_file_exist "/usr/share/elasticsearch/bin/jvm-example" + assert_file_exist "/usr/share/elasticsearch/bin/jvm-example/test" + assert_file_exist "$TEMP_CONFIG_DIR/jvm-example" + assert_file_exist "$TEMP_CONFIG_DIR/jvm-example/example.yaml" + assert_file_exist "/usr/share/elasticsearch/plugins/jvm-example" + assert_file_exist "/usr/share/elasticsearch/plugins/jvm-example/plugin-descriptor.properties" + assert_file_exist "/usr/share/elasticsearch/plugins/jvm-example/elasticsearch-jvm-example-"*".jar" # Remove the plugin - run /usr/share/elasticsearch/bin/plugin remove elasticsearch/shield/latest + run /usr/share/elasticsearch/bin/plugin remove jvm-example [ "$status" -eq 0 ] # Checks that the plugin is correctly removed - assert_file_not_exist "/usr/share/elasticsearch/bin/shield" - assert_file_exist "$TEMP_CONFIG_DIR/shield" - assert_file_exist "$TEMP_CONFIG_DIR/shield/role_mapping.yml" - assert_file_exist "$TEMP_CONFIG_DIR/shield/roles.yml" - assert_file_exist "$TEMP_CONFIG_DIR/shield/users" - assert_file_exist "$TEMP_CONFIG_DIR/shield/users_roles" - assert_file_not_exist "/usr/share/elasticsearch/plugins/shield" + assert_file_not_exist "/usr/share/elasticsearch/bin/jvm-example" + assert_file_exist "$TEMP_CONFIG_DIR/jvm-example" + assert_file_exist "$TEMP_CONFIG_DIR/jvm-example/example.yaml" + assert_file_not_exist "/usr/share/elasticsearch/plugins/jvm-example" # Delete the custom plugins directory run rm -rf "$TEMP_CONFIG_DIR" diff --git a/qa/vagrant/src/test/resources/packaging/scripts/packaging_test_utils.bash b/qa/vagrant/src/test/resources/packaging/scripts/packaging_test_utils.bash index ffe8d86bdc6..a1b16a6943a 100644 --- a/qa/vagrant/src/test/resources/packaging/scripts/packaging_test_utils.bash +++ b/qa/vagrant/src/test/resources/packaging/scripts/packaging_test_utils.bash @@ -26,6 +26,9 @@ # under the License. +# Variables used by tests +EXAMPLE_PLUGIN_ZIP=$(readlink -m elasticsearch-jvm-example-*.zip) + # Checks if necessary commands are available to run the tests if [ ! -x /usr/bin/which ]; then @@ -134,11 +137,17 @@ skip_not_zip() { } assert_file_exist() { - [ -e "$1" ] + local file="$1" + echo "Should exist: ${file}" + local file=$(readlink -m "${file}") + [ -e "$file" ] } assert_file_not_exist() { - [ ! -e "$1" ] + local file="$1" + echo "Should not exist: ${file}" + local file=$(readlink -m "${file}") + [ ! -e "$file" ] } assert_file() {