2015-08-21 16:05:50 -04:00
|
|
|
#!/usr/bin/env bats
|
|
|
|
|
|
|
|
# This file is used to test the installation and removal
|
|
|
|
# of plugins after Elasticsearch has been installed with tar.gz,
|
|
|
|
# rpm, and deb.
|
|
|
|
|
|
|
|
# WARNING: This testing file must be executed as root and can
|
2017-04-26 10:40:35 -04:00
|
|
|
# dramatically change your system. It should only be executed
|
|
|
|
# in a throw-away VM like those made by the Vagrantfile at
|
|
|
|
# the root of the Elasticsearch source code. This should
|
|
|
|
# cause the script to fail if it is executed any other way:
|
|
|
|
[ -f /etc/is_vagrant_vm ] || {
|
|
|
|
>&2 echo "must be run on a vagrant VM"
|
|
|
|
exit 1
|
|
|
|
}
|
2015-08-21 16:05:50 -04:00
|
|
|
|
|
|
|
# The test case can be executed with the Bash Automated
|
|
|
|
# Testing System tool available at https://github.com/sstephenson/bats
|
|
|
|
# Thanks to Sam Stephenson!
|
|
|
|
|
|
|
|
# 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.
|
|
|
|
|
|
|
|
##################################
|
|
|
|
# Common test cases for both tar and rpm/deb based plugin tests
|
|
|
|
##################################
|
2016-03-16 19:29:16 -04:00
|
|
|
# This file is symlinked to both 25_tar_plugins.bats and 50_modules_and_plugins.bats so its
|
2015-08-21 16:05:50 -04:00
|
|
|
# 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
|
2016-10-19 04:01:13 -04:00
|
|
|
load $BATS_UTILS/utils.bash
|
|
|
|
load $BATS_UTILS/modules.bash
|
|
|
|
load $BATS_UTILS/plugins.bash
|
2015-08-21 16:05:50 -04:00
|
|
|
|
|
|
|
setup() {
|
|
|
|
# The rules on when we should clean an reinstall are complex - all the
|
|
|
|
# jvm-example tests need cleaning because they are rough on the filesystem.
|
|
|
|
# The first and any tests that find themselves without an ESHOME need to
|
|
|
|
# clean as well.... this is going to mostly only happen on the first
|
|
|
|
# non-jvm-example-plugin-test _and_ any first test if you comment out the
|
|
|
|
# other tests. Commenting out lots of test cases seems like a reasonably
|
|
|
|
# common workflow.
|
|
|
|
if [ $BATS_TEST_NUMBER == 1 ] ||
|
2018-01-26 11:34:24 -05:00
|
|
|
[[ $BATS_TEST_NAME =~ install_a_sample_plugin ]] ||
|
2015-08-21 16:05:50 -04:00
|
|
|
[ ! -d "$ESHOME" ]; then
|
|
|
|
clean_before_test
|
|
|
|
install
|
2018-05-29 14:06:14 -04:00
|
|
|
set_debug_logging
|
2015-08-21 16:05:50 -04:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
if [[ "$BATS_TEST_FILENAME" =~ 25_tar_plugins.bats$ ]]; then
|
2016-10-19 04:01:13 -04:00
|
|
|
load $BATS_UTILS/tar.bash
|
2015-08-21 16:05:50 -04:00
|
|
|
GROUP='TAR PLUGINS'
|
|
|
|
install() {
|
|
|
|
install_archive
|
|
|
|
verify_archive_installation
|
|
|
|
}
|
|
|
|
export ESHOME=/tmp/elasticsearch
|
|
|
|
export_elasticsearch_paths
|
2015-09-15 11:33:39 -04:00
|
|
|
export ESPLUGIN_COMMAND_USER=elasticsearch
|
2015-08-21 16:05:50 -04:00
|
|
|
else
|
2016-10-19 04:01:13 -04:00
|
|
|
load $BATS_UTILS/packages.bash
|
2015-08-21 16:05:50 -04:00
|
|
|
if is_rpm; then
|
|
|
|
GROUP='RPM PLUGINS'
|
|
|
|
elif is_dpkg; then
|
|
|
|
GROUP='DEB PLUGINS'
|
|
|
|
fi
|
2015-09-01 22:12:18 -04:00
|
|
|
export_elasticsearch_paths
|
2015-09-15 11:33:39 -04:00
|
|
|
export ESPLUGIN_COMMAND_USER=root
|
2015-08-21 16:05:50 -04:00
|
|
|
install() {
|
|
|
|
install_package
|
|
|
|
verify_package_installation
|
|
|
|
}
|
|
|
|
fi
|
|
|
|
|
2018-01-26 11:34:24 -05:00
|
|
|
@test "[$GROUP] install a sample plugin with a symlinked plugins path" {
|
2016-05-26 14:10:32 -04:00
|
|
|
# Clean up after the last time this test was run
|
2018-08-07 11:59:56 -04:00
|
|
|
rm -rf /var/plugins.*
|
|
|
|
rm -rf /var/old_plugins.*
|
2016-05-26 14:10:32 -04:00
|
|
|
|
|
|
|
rm -rf "$ESPLUGINS"
|
2018-08-07 11:59:56 -04:00
|
|
|
# The custom plugins directory is not under /tmp or /var/tmp because
|
2018-10-03 13:11:39 -04:00
|
|
|
# systemd's private temp directory functionally means different
|
2018-08-07 11:59:56 -04:00
|
|
|
# processes can have different views of what's in these directories
|
|
|
|
local es_plugins=$(mktemp -p /var -d -t 'plugins.XXXX')
|
2016-05-26 14:10:32 -04:00
|
|
|
chown -R elasticsearch:elasticsearch "$es_plugins"
|
|
|
|
ln -s "$es_plugins" "$ESPLUGINS"
|
|
|
|
|
2018-01-26 11:34:24 -05:00
|
|
|
install_plugin_example
|
2016-05-26 14:10:32 -04:00
|
|
|
start_elasticsearch_service
|
2018-01-26 11:34:24 -05:00
|
|
|
|
2016-05-26 14:10:32 -04:00
|
|
|
# check that symlinked plugin was actually picked up
|
2018-01-26 11:34:24 -05:00
|
|
|
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
|
2016-05-26 14:10:32 -04:00
|
|
|
diff /tmp/installed /tmp/expected
|
2018-01-26 11:34:24 -05:00
|
|
|
|
2016-05-26 14:10:32 -04:00
|
|
|
stop_elasticsearch_service
|
2018-01-26 11:34:24 -05:00
|
|
|
remove_plugin_example
|
2016-05-26 14:10:32 -04:00
|
|
|
|
|
|
|
unlink "$ESPLUGINS"
|
|
|
|
}
|
|
|
|
|
2018-01-26 11:34:24 -05:00
|
|
|
@test "[$GROUP] install a sample plugin with a custom CONFIG_DIR" {
|
2015-08-21 16:05:50 -04:00
|
|
|
# Clean up after the last time we ran this test
|
|
|
|
rm -rf /tmp/config.*
|
|
|
|
|
|
|
|
move_config
|
|
|
|
|
2018-01-26 11:34:24 -05:00
|
|
|
ES_PATH_CONF="$ESCONFIG" install_plugin_example
|
2017-08-14 17:19:06 -04:00
|
|
|
ES_PATH_CONF="$ESCONFIG" start_elasticsearch_service
|
2018-01-26 11:34:24 -05:00
|
|
|
|
|
|
|
# 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
|
|
|
|
|
2015-09-24 11:39:00 -04:00
|
|
|
stop_elasticsearch_service
|
2018-01-26 11:34:24 -05:00
|
|
|
ES_PATH_CONF="$ESCONFIG" remove_plugin_example
|
2015-08-21 16:05:50 -04:00
|
|
|
}
|
|
|
|
|
2018-01-26 11:34:24 -05:00
|
|
|
@test "[$GROUP] install a sample plugin from a directory with a space" {
|
2015-08-21 16:05:50 -04:00
|
|
|
rm -rf "/tmp/plugins with space"
|
|
|
|
mkdir -p "/tmp/plugins with space"
|
2019-08-13 15:45:29 -04:00
|
|
|
local zip=$(ls $BATS_PLUGINS/custom-settings-*.zip)
|
|
|
|
local zipname=$(basename $zip)
|
2015-08-21 16:05:50 -04:00
|
|
|
cp $zip "/tmp/plugins with space"
|
|
|
|
|
2019-08-13 15:45:29 -04:00
|
|
|
install_plugin_example "/tmp/plugins with space/$zipname"
|
2018-01-26 11:34:24 -05:00
|
|
|
remove_plugin_example
|
2015-08-21 16:05:50 -04:00
|
|
|
}
|
|
|
|
|
2018-01-26 11:34:24 -05:00
|
|
|
@test "[$GROUP] install a sample plugin to elasticsearch directory with a space" {
|
2015-08-21 16:05:50 -04:00
|
|
|
[ "$GROUP" == "TAR PLUGINS" ] || skip "Test case only supported by TAR PLUGINS"
|
|
|
|
|
|
|
|
move_elasticsearch "/tmp/elastic search"
|
|
|
|
|
2018-01-26 11:34:24 -05:00
|
|
|
install_plugin_example
|
|
|
|
remove_plugin_example
|
2015-08-21 16:05:50 -04:00
|
|
|
}
|
|
|
|
|
2015-09-01 16:56:36 -04:00
|
|
|
# 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.
|
2018-01-26 11:34:24 -05:00
|
|
|
@test "[$GROUP] install a sample plugin" {
|
|
|
|
install_plugin_example
|
2015-09-01 16:56:36 -04:00
|
|
|
}
|
|
|
|
|
2015-08-21 16:05:50 -04:00
|
|
|
@test "[$GROUP] install icu plugin" {
|
2015-09-01 16:56:36 -04:00
|
|
|
install_and_check_plugin analysis icu icu4j-*.jar
|
2015-08-21 16:05:50 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
@test "[$GROUP] install kuromoji plugin" {
|
2015-09-01 16:56:36 -04:00
|
|
|
install_and_check_plugin analysis kuromoji
|
2015-08-21 16:05:50 -04:00
|
|
|
}
|
|
|
|
|
2018-05-04 16:46:04 -04:00
|
|
|
@test "[$GROUP] install nori plugin" {
|
|
|
|
install_and_check_plugin analysis nori
|
|
|
|
}
|
|
|
|
|
2015-08-21 16:05:50 -04:00
|
|
|
@test "[$GROUP] install phonetic plugin" {
|
2015-09-01 16:56:36 -04:00
|
|
|
install_and_check_plugin analysis phonetic commons-codec-*.jar
|
2015-08-21 16:05:50 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
@test "[$GROUP] install smartcn plugin" {
|
2015-09-01 16:56:36 -04:00
|
|
|
install_and_check_plugin analysis smartcn
|
2015-08-21 16:05:50 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
@test "[$GROUP] install stempel plugin" {
|
2015-09-01 16:56:36 -04:00
|
|
|
install_and_check_plugin analysis stempel
|
2015-08-21 16:05:50 -04:00
|
|
|
}
|
|
|
|
|
2016-10-31 16:38:33 -04:00
|
|
|
@test "[$GROUP] install ukrainian plugin" {
|
|
|
|
install_and_check_plugin analysis ukrainian morfologik-fsa-*.jar morfologik-stemming-*.jar
|
|
|
|
}
|
|
|
|
|
2015-08-21 16:05:50 -04:00
|
|
|
@test "[$GROUP] install gce plugin" {
|
2015-09-26 05:53:21 -04:00
|
|
|
install_and_check_plugin discovery gce google-api-client-*.jar
|
2015-08-21 16:05:50 -04:00
|
|
|
}
|
|
|
|
|
2016-06-30 08:39:23 -04:00
|
|
|
@test "[$GROUP] install discovery-azure-classic plugin" {
|
2016-06-30 14:47:38 -04:00
|
|
|
install_and_check_plugin discovery azure-classic azure-core-*.jar
|
2015-09-21 15:43:32 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
@test "[$GROUP] install discovery-ec2 plugin" {
|
2015-09-10 14:33:33 -04:00
|
|
|
install_and_check_plugin discovery ec2 aws-java-sdk-core-*.jar
|
|
|
|
}
|
|
|
|
|
2016-03-16 19:58:14 -04:00
|
|
|
@test "[$GROUP] install ingest-attachment plugin" {
|
2018-10-12 12:09:14 -04:00
|
|
|
# we specify the version on the poi-4.0.0.jar so that the test does
|
2016-03-16 19:58:14 -04:00
|
|
|
# not spuriously pass if the jar is missing but the other poi jars
|
|
|
|
# are present
|
2018-10-12 12:09:14 -04:00
|
|
|
install_and_check_plugin ingest attachment bcprov-jdk15on-*.jar tika-core-*.jar pdfbox-*.jar poi-4.0.0.jar poi-ooxml-4.0.0.jar poi-ooxml-schemas-*.jar poi-scratchpad-*.jar
|
2016-03-16 19:58:14 -04:00
|
|
|
}
|
|
|
|
|
2016-06-08 14:03:48 -04:00
|
|
|
@test "[$GROUP] check ingest-common module" {
|
|
|
|
check_module ingest-common jcodings-*.jar joni-*.jar
|
2015-12-09 19:32:37 -05:00
|
|
|
}
|
|
|
|
|
2018-12-22 07:21:49 -05:00
|
|
|
@test "[$GROUP] check ingest-geoip module" {
|
|
|
|
check_module ingest-geoip geoip2-*.jar jackson-annotations-*.jar jackson-databind-*.jar maxmind-db-*.jar
|
|
|
|
}
|
|
|
|
|
2018-12-22 20:20:53 -05:00
|
|
|
@test "[$GROUP] check ingest-user-agent module" {
|
|
|
|
check_module ingest-user-agent
|
|
|
|
}
|
|
|
|
|
2016-03-16 19:29:16 -04:00
|
|
|
@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
|
2015-12-09 19:32:37 -05:00
|
|
|
}
|
|
|
|
|
2016-03-16 19:29:16 -04:00
|
|
|
@test "[$GROUP] check lang-mustache module" {
|
|
|
|
check_secure_module lang-mustache compiler-*.jar
|
|
|
|
}
|
|
|
|
|
|
|
|
@test "[$GROUP] check lang-painless module" {
|
2016-06-13 10:35:10 -04:00
|
|
|
check_secure_module lang-painless antlr4-runtime-*.jar asm-debug-all-*.jar
|
2015-12-09 19:32:37 -05:00
|
|
|
}
|
|
|
|
|
2015-09-10 14:33:33 -04:00
|
|
|
@test "[$GROUP] install murmur3 mapper plugin" {
|
2015-09-01 16:56:36 -04:00
|
|
|
install_and_check_plugin mapper murmur3
|
2015-08-21 16:05:50 -04:00
|
|
|
}
|
|
|
|
|
2018-09-18 05:25:27 -04:00
|
|
|
@test "[$GROUP] install annotated-text mapper plugin" {
|
|
|
|
install_and_check_plugin mapper annotated-text
|
|
|
|
}
|
|
|
|
|
2016-03-16 19:29:16 -04:00
|
|
|
@test "[$GROUP] check reindex module" {
|
|
|
|
check_module reindex
|
|
|
|
}
|
|
|
|
|
2016-03-16 19:58:14 -04:00
|
|
|
@test "[$GROUP] install repository-hdfs plugin" {
|
2017-07-01 15:36:18 -04:00
|
|
|
install_and_check_plugin repository hdfs hadoop-client-*.jar hadoop-common-*.jar hadoop-annotations-*.jar hadoop-auth-*.jar hadoop-hdfs-client-*.jar htrace-core4-*.jar guava-*.jar protobuf-java-*.jar commons-logging-*.jar commons-cli-*.jar commons-collections-*.jar commons-configuration-*.jar commons-io-*.jar commons-lang-*.jar servlet-api-*.jar slf4j-api-*.jar
|
2016-03-16 19:58:14 -04:00
|
|
|
}
|
|
|
|
|
2015-09-10 14:33:33 -04:00
|
|
|
@test "[$GROUP] install size mapper plugin" {
|
2015-09-01 16:56:36 -04:00
|
|
|
install_and_check_plugin mapper size
|
|
|
|
}
|
|
|
|
|
2015-09-21 15:43:32 -04:00
|
|
|
@test "[$GROUP] install repository-azure plugin" {
|
|
|
|
install_and_check_plugin repository azure azure-storage-*.jar
|
|
|
|
}
|
|
|
|
|
2015-09-15 11:35:10 -04:00
|
|
|
@test "[$GROUP] install repository-gcs plugin" {
|
|
|
|
install_and_check_plugin repository gcs google-api-services-storage-*.jar
|
|
|
|
}
|
|
|
|
|
2015-09-21 15:43:32 -04:00
|
|
|
@test "[$GROUP] install repository-s3 plugin" {
|
2015-09-10 14:33:33 -04:00
|
|
|
install_and_check_plugin repository s3 aws-java-sdk-core-*.jar
|
|
|
|
}
|
|
|
|
|
2015-09-21 15:43:32 -04:00
|
|
|
@test "[$GROUP] install store-smb plugin" {
|
|
|
|
install_and_check_plugin store smb
|
|
|
|
}
|
|
|
|
|
2018-01-08 10:48:16 -05:00
|
|
|
@test "[$GROUP] install transport-nio plugin" {
|
|
|
|
install_and_check_plugin transport nio
|
|
|
|
}
|
|
|
|
|
2015-09-16 11:11:49 -04:00
|
|
|
@test "[$GROUP] check the installed plugins can be listed with 'plugins list' and result matches the list of plugins in plugins pom" {
|
2016-09-12 19:00:28 -04:00
|
|
|
"$ESHOME/bin/elasticsearch-plugin" list | cut -d'@' -f1 > /tmp/installed
|
2015-09-16 11:11:49 -04:00
|
|
|
compare_plugins_list "/tmp/installed" "'plugins list'"
|
|
|
|
}
|
|
|
|
|
2015-09-01 16:56:36 -04:00
|
|
|
@test "[$GROUP] start elasticsearch with all plugins installed" {
|
|
|
|
start_elasticsearch_service
|
|
|
|
}
|
|
|
|
|
2015-09-10 14:33:33 -04:00
|
|
|
@test "[$GROUP] check the installed plugins matches the list of build plugins" {
|
2015-09-16 11:11:49 -04:00
|
|
|
curl -s localhost:9200/_cat/plugins?h=c | sed 's/ *$//' > /tmp/installed
|
|
|
|
compare_plugins_list "/tmp/installed" "_cat/plugins"
|
2015-09-01 16:56:36 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
@test "[$GROUP] stop elasticsearch" {
|
|
|
|
stop_elasticsearch_service
|
|
|
|
}
|
|
|
|
|
2018-01-26 11:34:24 -05:00
|
|
|
@test "[$GROUP] remove a sample plugin" {
|
|
|
|
remove_plugin_example
|
2015-09-01 16:56:36 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
@test "[$GROUP] remove icu plugin" {
|
|
|
|
remove_plugin analysis-icu
|
|
|
|
}
|
|
|
|
|
|
|
|
@test "[$GROUP] remove kuromoji plugin" {
|
|
|
|
remove_plugin analysis-kuromoji
|
|
|
|
}
|
|
|
|
|
2018-05-04 16:46:04 -04:00
|
|
|
@test "[$GROUP] remove nori plugin" {
|
|
|
|
remove_plugin analysis-nori
|
|
|
|
}
|
|
|
|
|
2015-09-01 16:56:36 -04:00
|
|
|
@test "[$GROUP] remove phonetic plugin" {
|
|
|
|
remove_plugin analysis-phonetic
|
|
|
|
}
|
|
|
|
|
|
|
|
@test "[$GROUP] remove smartcn plugin" {
|
|
|
|
remove_plugin analysis-smartcn
|
|
|
|
}
|
|
|
|
|
|
|
|
@test "[$GROUP] remove stempel plugin" {
|
|
|
|
remove_plugin analysis-stempel
|
|
|
|
}
|
|
|
|
|
2016-10-31 16:38:33 -04:00
|
|
|
@test "[$GROUP] remove ukrainian plugin" {
|
|
|
|
remove_plugin analysis-ukrainian
|
|
|
|
}
|
|
|
|
|
2015-09-01 16:56:36 -04:00
|
|
|
@test "[$GROUP] remove gce plugin" {
|
2015-09-26 05:53:21 -04:00
|
|
|
remove_plugin discovery-gce
|
2015-09-01 16:56:36 -04:00
|
|
|
}
|
|
|
|
|
2016-06-30 08:39:23 -04:00
|
|
|
@test "[$GROUP] remove discovery-azure-classic plugin" {
|
|
|
|
remove_plugin discovery-azure-classic
|
2015-09-21 15:43:32 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
@test "[$GROUP] remove discovery-ec2 plugin" {
|
2015-09-10 14:33:33 -04:00
|
|
|
remove_plugin discovery-ec2
|
|
|
|
}
|
|
|
|
|
2016-03-16 19:58:14 -04:00
|
|
|
@test "[$GROUP] remove ingest-attachment plugin" {
|
|
|
|
remove_plugin ingest-attachment
|
|
|
|
}
|
|
|
|
|
2015-09-10 14:33:33 -04:00
|
|
|
@test "[$GROUP] remove murmur3 mapper plugin" {
|
2015-09-01 16:56:36 -04:00
|
|
|
remove_plugin mapper-murmur3
|
|
|
|
}
|
|
|
|
|
2018-09-18 05:25:27 -04:00
|
|
|
@test "[$GROUP] remove annotated-text mapper plugin" {
|
|
|
|
remove_plugin mapper-annotated-text
|
|
|
|
}
|
|
|
|
|
2015-09-10 14:33:33 -04:00
|
|
|
@test "[$GROUP] remove size mapper plugin" {
|
2015-09-01 16:56:36 -04:00
|
|
|
remove_plugin mapper-size
|
|
|
|
}
|
|
|
|
|
2015-09-21 15:43:32 -04:00
|
|
|
@test "[$GROUP] remove repository-azure plugin" {
|
|
|
|
remove_plugin repository-azure
|
|
|
|
}
|
|
|
|
|
2015-09-15 11:35:10 -04:00
|
|
|
@test "[$GROUP] remove repository-gcs plugin" {
|
|
|
|
remove_plugin repository-gcs
|
|
|
|
}
|
|
|
|
|
2016-03-16 19:58:14 -04:00
|
|
|
@test "[$GROUP] remove repository-hdfs plugin" {
|
|
|
|
remove_plugin repository-hdfs
|
|
|
|
}
|
|
|
|
|
2015-09-21 15:43:32 -04:00
|
|
|
@test "[$GROUP] remove repository-s3 plugin" {
|
2015-09-10 14:33:33 -04:00
|
|
|
remove_plugin repository-s3
|
|
|
|
}
|
|
|
|
|
2015-09-21 15:43:32 -04:00
|
|
|
@test "[$GROUP] remove store-smb plugin" {
|
|
|
|
remove_plugin store-smb
|
|
|
|
}
|
|
|
|
|
2018-01-08 10:48:16 -05:00
|
|
|
@test "[$GROUP] remove transport-nio plugin" {
|
|
|
|
remove_plugin transport-nio
|
|
|
|
}
|
|
|
|
|
2015-09-01 16:56:36 -04:00
|
|
|
@test "[$GROUP] start elasticsearch with all plugins removed" {
|
|
|
|
start_elasticsearch_service
|
|
|
|
}
|
|
|
|
|
|
|
|
@test "[$GROUP] check that there are now no plugins installed" {
|
|
|
|
curl -s localhost:9200/_cat/plugins > /tmp/installed
|
|
|
|
local installedCount=$(cat /tmp/installed | wc -l)
|
|
|
|
[ "$installedCount" == "0" ] || {
|
|
|
|
echo "Expected all plugins to be removed but found $installedCount:"
|
|
|
|
cat /tmp/installed
|
|
|
|
false
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@test "[$GROUP] stop elasticsearch" {
|
|
|
|
stop_elasticsearch_service
|
2015-08-21 16:05:50 -04:00
|
|
|
}
|
2015-10-06 08:13:24 -04:00
|
|
|
|
2018-01-26 11:34:24 -05:00
|
|
|
@test "[$GROUP] install a sample plugin with different logging modes and check output" {
|
2019-08-13 15:45:29 -04:00
|
|
|
local relativePath=${1:-$(readlink -m $BATS_PLUGINS/custom-settings-*.zip)}
|
2018-04-03 21:23:01 -04:00
|
|
|
sudo -E -u $ESPLUGIN_COMMAND_USER "$ESHOME/bin/elasticsearch-plugin" install --batch "file://$relativePath" > /tmp/plugin-cli-output
|
2016-06-30 03:08:31 -04:00
|
|
|
# exclude progress line
|
|
|
|
local loglines=$(cat /tmp/plugin-cli-output | grep -v "^[[:cntrl:]]" | wc -l)
|
2016-11-02 13:07:26 -04:00
|
|
|
[ "$loglines" -eq "2" ] || {
|
|
|
|
echo "Expected 2 lines excluding progress bar but the output had $loglines lines and was:"
|
|
|
|
cat /tmp/plugin-cli-output
|
|
|
|
false
|
|
|
|
}
|
2018-01-26 11:34:24 -05:00
|
|
|
remove_plugin_example
|
2015-10-06 08:13:24 -04:00
|
|
|
|
2019-08-13 15:45:29 -04:00
|
|
|
local relativePath=${1:-$(readlink -m $BATS_PLUGINS/custom-settings-*.zip)}
|
2018-04-03 21:23:01 -04:00
|
|
|
sudo -E -u $ESPLUGIN_COMMAND_USER ES_JAVA_OPTS="-Des.logger.level=DEBUG" "$ESHOME/bin/elasticsearch-plugin" install --batch "file://$relativePath" > /tmp/plugin-cli-output
|
2016-06-30 03:08:31 -04:00
|
|
|
local loglines=$(cat /tmp/plugin-cli-output | grep -v "^[[:cntrl:]]" | wc -l)
|
2016-11-02 13:07:26 -04:00
|
|
|
[ "$loglines" -gt "2" ] || {
|
|
|
|
echo "Expected more than 2 lines excluding progress bar but the output had $loglines lines and was:"
|
|
|
|
cat /tmp/plugin-cli-output
|
|
|
|
false
|
|
|
|
}
|
2018-01-26 11:34:24 -05:00
|
|
|
remove_plugin_example
|
2015-10-06 08:13:24 -04:00
|
|
|
}
|
2016-04-06 13:28:56 -04:00
|
|
|
|
|
|
|
@test "[$GROUP] test java home with space" {
|
|
|
|
# preserve JAVA_HOME
|
|
|
|
local java_home=$JAVA_HOME
|
|
|
|
|
|
|
|
# create a JAVA_HOME with a space
|
|
|
|
local java=$(which java)
|
|
|
|
local temp=`mktemp -d --suffix="java home"`
|
|
|
|
mkdir -p "$temp/bin"
|
|
|
|
ln -s "$java" "$temp/bin/java"
|
|
|
|
export JAVA_HOME="$temp"
|
|
|
|
|
|
|
|
# this will fail if the elasticsearch-plugin script does not
|
|
|
|
# properly handle JAVA_HOME with spaces
|
|
|
|
"$ESHOME/bin/elasticsearch-plugin" list
|
|
|
|
|
|
|
|
rm -rf "$temp"
|
|
|
|
|
|
|
|
# restore JAVA_HOME
|
|
|
|
export JAVA_HOME=$java_home
|
|
|
|
}
|
2016-05-04 12:48:39 -04:00
|
|
|
|
|
|
|
@test "[$GROUP] test ES_JAVA_OPTS" {
|
|
|
|
# preserve ES_JAVA_OPTS
|
|
|
|
local es_java_opts=$ES_JAVA_OPTS
|
|
|
|
|
|
|
|
export ES_JAVA_OPTS="-XX:+PrintFlagsFinal"
|
|
|
|
# this will fail if ES_JAVA_OPTS is not passed through
|
|
|
|
"$ESHOME/bin/elasticsearch-plugin" list | grep MaxHeapSize
|
|
|
|
|
|
|
|
# restore ES_JAVA_OPTS
|
|
|
|
export ES_JAVA_OPTS=$es_java_opts
|
|
|
|
}
|
2017-05-06 13:25:10 -04:00
|
|
|
|
|
|
|
@test "[$GROUP] test umask" {
|
2019-08-13 15:45:29 -04:00
|
|
|
install_plugin_example $(readlink -m $BATS_PLUGINS/custom-settings-*.zip) 0077
|
2017-05-06 13:25:10 -04:00
|
|
|
}
|
2017-08-17 16:51:02 -04:00
|
|
|
|
|
|
|
@test "[$GROUP] hostname" {
|
|
|
|
local temp=`mktemp -d`
|
|
|
|
cp "$ESCONFIG"/elasticsearch.yml "$temp"
|
|
|
|
echo 'node.name: ${HOSTNAME}' >> "$ESCONFIG"/elasticsearch.yml
|
|
|
|
start_elasticsearch_service
|
|
|
|
wait_for_elasticsearch_status
|
|
|
|
[ "$(curl -XGET localhost:9200/_cat/nodes?h=name)" == "$HOSTNAME" ]
|
|
|
|
stop_elasticsearch_service
|
|
|
|
cp "$temp"/elasticsearch.yml "$ESCONFIG"/elasticsearch.yml
|
|
|
|
rm -rf "$temp"
|
|
|
|
}
|