Browse Source

Add tests for plugins with bin directory

Also removes all mention of shield:
```bash
$ find $BATS -type f -exec grep -Hi shield {} \;
$
```
Nik Everett 10 years ago
parent
commit
0b650ed203

+ 31 - 47
qa/vagrant/src/test/resources/packaging/scripts/25_tar_plugins.bats

@@ -50,28 +50,27 @@ setup() {
     # Checks that plugin archive is available
     [ -e "$EXAMPLE_PLUGIN_ZIP" ]
 
-    # Install Shield
+    # Install jvm-example
     run /tmp/elasticsearch/bin/plugin install jvm-example -u "file://$EXAMPLE_PLUGIN_ZIP"
     [ "$status" -eq 0 ]
 
     # Checks that the plugin is correctly installed
-    # TODO add bin to jvm-example
-    # 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/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 jvm-example
     [ "$status" -eq 0 ]
 
     # Checks that the plugin is correctly removed
-    # TODO add bin the jvm-example
-    # assert_file_not_exist "/tmp/elasticsearch/bin/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"
@@ -96,15 +95,13 @@ setup() {
     # Checks that plugin archive is available
     [ -e "$EXAMPLE_PLUGIN_ZIP" ]
 
-    # Install Shield
+    # Install jvm-example
     run /tmp/elasticsearch/bin/plugin install jvm-example -u "file://$EXAMPLE_PLUGIN_ZIP"
     [ "$status" -eq 0 ]
 
     # Checks that the plugin is correctly installed
-    # TODO add bin to jvm-example
-    # 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/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"
@@ -116,8 +113,7 @@ setup() {
     [ "$status" -eq 0 ]
 
     # Checks that the plugin is correctly removed
-    # TODO add bin to jvm-example
-    # assert_file_not_exist "/tmp/elasticsearch/bin/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"
@@ -149,15 +145,13 @@ setup() {
     # Checks that plugin archive is available
     [ -e "$EXAMPLE_PLUGIN_ZIP" ]
 
-    # Install Shield with the CONF_DIR environment variable
+    # 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
-    # TODO add bin to jvm-example
-    # assert_file_exist "/tmp/elasticsearch/bin/shield"
-    # assert_file_exist "/tmp/elasticsearch/bin/shield/esusers"
-    # assert_file_exist "/tmp/elasticsearch/bin/shield/syskeygen"
+    # 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"
@@ -169,8 +163,7 @@ setup() {
     [ "$status" -eq 0 ]
 
     # Checks that the plugin is correctly removed
-    # TODO add bin to jvm-example
-    # assert_file_not_exist "/tmp/elasticsearch/bin/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"
@@ -206,15 +199,13 @@ setup() {
     # Checks that plugin archive is available
     [ -e "$EXAMPLE_PLUGIN_ZIP" ]
 
-    # Install Shield
+    # 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
-    # TODO add bin to jvm-example
-    # assert_file_exist "/tmp/elasticsearch/bin/shield"
-    # assert_file_exist "/tmp/elasticsearch/bin/shield/esusers"
-    # assert_file_exist "/tmp/elasticsearch/bin/shield/syskeygen"
+    # 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"
@@ -226,8 +217,7 @@ setup() {
     [ "$status" -eq 0 ]
 
     # Checks that the plugin is correctly removed
-    # TODO add bin to jvm-example
-    # assert_file_not_exist "/tmp/elasticsearch/bin/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"
@@ -253,15 +243,13 @@ setup() {
     # Checks that plugin archive is available
     [ -e "$EXAMPLE_PLUGIN_ZIP" ]
 
-    # Install Shield
+    # 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
-    # TODO add bin to jvm-example
-    # assert_file_exist "$ES_DIR/bin/shield"
-    # assert_file_exist "$ES_DIR/bin/shield/esusers"
-    # assert_file_exist "$ES_DIR/bin/shield/syskeygen"
+    # 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"
@@ -273,8 +261,7 @@ setup() {
     [ "$status" -eq 0 ]
 
     # Checks that the plugin is correctly removed
-    # TODO add bin to jvm-example
-    # assert_file_not_exist "$ES_DIR/bin/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"
@@ -295,20 +282,18 @@ setup() {
     # Checks that plugin archive is available
     [ -e "$EXAMPLE_PLUGIN_ZIP" ]
 
-    # Copy the shield plugin to a directory with a space in it
+    # 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
+    # Install jvm-example
     run /tmp/elasticsearch/bin/plugin install jvm-example -u "file://$EXAMPLE_PLUGIN_ZIP_WITH_SPACE"
     [ "$status" -eq 0 ]
 
     # Checks that the plugin is correctly installed
-    # TODO add bin to jvm-example
-    # 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/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"
@@ -320,12 +305,11 @@ setup() {
     [ "$status" -eq 0 ]
 
     # Checks that the plugin is correctly removed
-    # TODO add bin the jvm-example
-    # assert_file_not_exist "/tmp/elasticsearch/bin/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"
 }

+ 24 - 36
qa/vagrant/src/test/resources/packaging/scripts/50_plugins.bats

@@ -63,15 +63,13 @@ install_package() {
     # Checks that plugin archive is available
     [ -e "$EXAMPLE_PLUGIN_ZIP" ]
 
-    # Install Shield
+    # 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
-    # TODO add bin to jvm-example
-    # 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"
+    # 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"
@@ -83,8 +81,7 @@ install_package() {
     [ "$status" -eq 0 ]
 
     # Checks that the plugin is correctly removed
-    # TODO add bin to jvm-example
-    # assert_file_not_exist "/usr/share/elasticsearch/bin/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"
@@ -113,15 +110,13 @@ install_package() {
     # Checks that plugin archive is available
     [ -e "$EXAMPLE_PLUGIN_ZIP" ]
 
-    # Install Shield
+    # 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
-    # TODO add bin to jvm-example
-    # 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"
+    # 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"
@@ -134,8 +129,7 @@ install_package() {
     [ "$status" -eq 0 ]
 
     # Checks that the plugin is correctly removed
-    # TODO add bin to jvm-example
-    # assert_file_not_exist "/usr/share/elasticsearch/bin/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"
@@ -178,15 +172,13 @@ install_package() {
     # Checks that plugin archive is available
     [ -e "$EXAMPLE_PLUGIN_ZIP" ]
 
-    # Install Shield
+    # 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
-    # TODO add bin to jvm-example
-    # 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"
+    # 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"
@@ -194,15 +186,14 @@ install_package() {
     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
-    # TODO add bin to jvm-example
-    # assert_file_not_exist "/usr/share/elasticsearch/bin/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_exist "/usr/share/elasticsearch/plugins/jvm-example"
+    assert_file_not_exist "/usr/share/elasticsearch/plugins/jvm-example"
 
     # Delete the custom plugins directory
     run rm -rf "$TEMP_CONFIG_DIR"
@@ -239,15 +230,13 @@ install_package() {
     # Checks that plugin archive is available
     [ -e "$EXAMPLE_PLUGIN_ZIP" ]
 
-    # Install Shield
+    # 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
-    # TODO add bin to jvm-example
-    # 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"
+    # 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"
@@ -255,15 +244,14 @@ install_package() {
     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
-    # TODO add bin to jvm-example
-    # assert_file_not_exist "/usr/share/elasticsearch/bin/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/shield"
+    assert_file_not_exist "/usr/share/elasticsearch/plugins/jvm-example"
 
     # Delete the custom plugins directory
     run rm -rf "$TEMP_CONFIG_DIR"