|
@@ -57,7 +57,7 @@ setup() {
|
|
|
# other tests. Commenting out lots of test cases seems like a reasonably
|
|
|
# common workflow.
|
|
|
if [ $BATS_TEST_NUMBER == 1 ] ||
|
|
|
- [[ $BATS_TEST_NAME =~ install_jvm.*example ]] ||
|
|
|
+ [[ $BATS_TEST_NAME =~ install_a_sample_plugin ]] ||
|
|
|
[ ! -d "$ESHOME" ]; then
|
|
|
clean_before_test
|
|
|
install
|
|
@@ -89,7 +89,7 @@ else
|
|
|
}
|
|
|
fi
|
|
|
|
|
|
-@test "[$GROUP] install jvm-example plugin with a symlinked plugins path" {
|
|
|
+@test "[$GROUP] install a sample plugin with a symlinked plugins path" {
|
|
|
# Clean up after the last time this test was run
|
|
|
rm -rf /tmp/plugins.*
|
|
|
rm -rf /tmp/old_plugins.*
|
|
@@ -99,48 +99,63 @@ fi
|
|
|
chown -R elasticsearch:elasticsearch "$es_plugins"
|
|
|
ln -s "$es_plugins" "$ESPLUGINS"
|
|
|
|
|
|
- install_jvm_example
|
|
|
+ install_plugin_example
|
|
|
start_elasticsearch_service
|
|
|
+
|
|
|
# check that symlinked plugin was actually picked up
|
|
|
- curl -s localhost:9200/_cat/configured_example | sed 's/ *$//' > /tmp/installed
|
|
|
- echo "foo" > /tmp/expected
|
|
|
+ curl -XGET -H 'Content-Type: application/json' 'http://localhost:9200/_cat/plugins?h=component' | sed 's/ *$//' > /tmp/installed
|
|
|
+ echo "custom-settings" > /tmp/expected
|
|
|
+ diff /tmp/installed /tmp/expected
|
|
|
+
|
|
|
+ curl -XGET -H 'Content-Type: application/json' 'http://localhost:9200/_cluster/settings?include_defaults&filter_path=defaults.custom.simple' > /tmp/installed
|
|
|
+ echo -n '{"defaults":{"custom":{"simple":"foo"}}}' > /tmp/expected
|
|
|
diff /tmp/installed /tmp/expected
|
|
|
+
|
|
|
stop_elasticsearch_service
|
|
|
- remove_jvm_example
|
|
|
+ remove_plugin_example
|
|
|
|
|
|
unlink "$ESPLUGINS"
|
|
|
}
|
|
|
|
|
|
-@test "[$GROUP] install jvm-example plugin with a custom CONFIG_DIR" {
|
|
|
+@test "[$GROUP] install a sample plugin with a custom CONFIG_DIR" {
|
|
|
# Clean up after the last time we ran this test
|
|
|
rm -rf /tmp/config.*
|
|
|
|
|
|
move_config
|
|
|
|
|
|
- ES_PATH_CONF="$ESCONFIG" install_jvm_example
|
|
|
+ ES_PATH_CONF="$ESCONFIG" install_plugin_example
|
|
|
ES_PATH_CONF="$ESCONFIG" start_elasticsearch_service
|
|
|
- diff <(curl -s localhost:9200/_cat/configured_example | sed 's/ //g') <(echo "foo")
|
|
|
+
|
|
|
+ # check that symlinked plugin was actually picked up
|
|
|
+ curl -XGET -H 'Content-Type: application/json' 'http://localhost:9200/_cat/plugins?h=component' | sed 's/ *$//' > /tmp/installed
|
|
|
+ echo "custom-settings" > /tmp/expected
|
|
|
+ diff /tmp/installed /tmp/expected
|
|
|
+
|
|
|
+ curl -XGET -H 'Content-Type: application/json' 'http://localhost:9200/_cluster/settings?include_defaults&filter_path=defaults.custom.simple' > /tmp/installed
|
|
|
+ echo -n '{"defaults":{"custom":{"simple":"foo"}}}' > /tmp/expected
|
|
|
+ diff /tmp/installed /tmp/expected
|
|
|
+
|
|
|
stop_elasticsearch_service
|
|
|
- ES_PATH_CONF="$ESCONFIG" remove_jvm_example
|
|
|
+ ES_PATH_CONF="$ESCONFIG" remove_plugin_example
|
|
|
}
|
|
|
|
|
|
-@test "[$GROUP] install jvm-example plugin from a directory with a space" {
|
|
|
+@test "[$GROUP] install a sample plugin from a directory with a space" {
|
|
|
rm -rf "/tmp/plugins with space"
|
|
|
mkdir -p "/tmp/plugins with space"
|
|
|
- local zip=$(ls jvm-example-*.zip)
|
|
|
+ local zip=$(ls custom-settings-*.zip)
|
|
|
cp $zip "/tmp/plugins with space"
|
|
|
|
|
|
- install_jvm_example "/tmp/plugins with space/$zip"
|
|
|
- remove_jvm_example
|
|
|
+ install_plugin_example "/tmp/plugins with space/$zip"
|
|
|
+ remove_plugin_example
|
|
|
}
|
|
|
|
|
|
-@test "[$GROUP] install jvm-example plugin to elasticsearch directory with a space" {
|
|
|
+@test "[$GROUP] install a sample plugin to elasticsearch directory with a space" {
|
|
|
[ "$GROUP" == "TAR PLUGINS" ] || skip "Test case only supported by TAR PLUGINS"
|
|
|
|
|
|
move_elasticsearch "/tmp/elastic search"
|
|
|
|
|
|
- install_jvm_example
|
|
|
- remove_jvm_example
|
|
|
+ install_plugin_example
|
|
|
+ remove_plugin_example
|
|
|
}
|
|
|
|
|
|
@test "[$GROUP] fail if java executable is not found" {
|
|
@@ -161,8 +176,8 @@ fi
|
|
|
|
|
|
# Note that all of the tests from here to the end of the file expect to be run
|
|
|
# in sequence and don't take well to being run one at a time.
|
|
|
-@test "[$GROUP] install jvm-example plugin" {
|
|
|
- install_jvm_example
|
|
|
+@test "[$GROUP] install a sample plugin" {
|
|
|
+ install_plugin_example
|
|
|
}
|
|
|
|
|
|
@test "[$GROUP] install icu plugin" {
|
|
@@ -293,8 +308,8 @@ fi
|
|
|
stop_elasticsearch_service
|
|
|
}
|
|
|
|
|
|
-@test "[$GROUP] remove jvm-example plugin" {
|
|
|
- remove_jvm_example
|
|
|
+@test "[$GROUP] remove a sample plugin" {
|
|
|
+ remove_plugin_example
|
|
|
}
|
|
|
|
|
|
@test "[$GROUP] remove icu plugin" {
|
|
@@ -399,8 +414,8 @@ fi
|
|
|
stop_elasticsearch_service
|
|
|
}
|
|
|
|
|
|
-@test "[$GROUP] install jvm-example with different logging modes and check output" {
|
|
|
- local relativePath=${1:-$(readlink -m jvm-example-*.zip)}
|
|
|
+@test "[$GROUP] install a sample plugin with different logging modes and check output" {
|
|
|
+ local relativePath=${1:-$(readlink -m custom-settings-*.zip)}
|
|
|
sudo -E -u $ESPLUGIN_COMMAND_USER "$ESHOME/bin/elasticsearch-plugin" install "file://$relativePath" > /tmp/plugin-cli-output
|
|
|
# exclude progress line
|
|
|
local loglines=$(cat /tmp/plugin-cli-output | grep -v "^[[:cntrl:]]" | wc -l)
|
|
@@ -409,9 +424,9 @@ fi
|
|
|
cat /tmp/plugin-cli-output
|
|
|
false
|
|
|
}
|
|
|
- remove_jvm_example
|
|
|
+ remove_plugin_example
|
|
|
|
|
|
- local relativePath=${1:-$(readlink -m jvm-example-*.zip)}
|
|
|
+ local relativePath=${1:-$(readlink -m custom-settings-*.zip)}
|
|
|
sudo -E -u $ESPLUGIN_COMMAND_USER ES_JAVA_OPTS="-Des.logger.level=DEBUG" "$ESHOME/bin/elasticsearch-plugin" install "file://$relativePath" > /tmp/plugin-cli-output
|
|
|
local loglines=$(cat /tmp/plugin-cli-output | grep -v "^[[:cntrl:]]" | wc -l)
|
|
|
[ "$loglines" -gt "2" ] || {
|
|
@@ -419,7 +434,7 @@ fi
|
|
|
cat /tmp/plugin-cli-output
|
|
|
false
|
|
|
}
|
|
|
- remove_jvm_example
|
|
|
+ remove_plugin_example
|
|
|
}
|
|
|
|
|
|
@test "[$GROUP] test java home with space" {
|
|
@@ -456,7 +471,7 @@ fi
|
|
|
}
|
|
|
|
|
|
@test "[$GROUP] test umask" {
|
|
|
- install_jvm_example $(readlink -m jvm-example-*.zip) 0077
|
|
|
+ install_plugin_example $(readlink -m custom-settings-*.zip) 0077
|
|
|
}
|
|
|
|
|
|
@test "[$GROUP] hostname" {
|