Merge pull request #13633 from andrestc/plugins-script-check-java

Adds a validation for plugins script to check if java is set
This commit is contained in:
Nik Everett 2015-09-21 14:40:26 -04:00
commit 1998c2ca4d
3 changed files with 28 additions and 0 deletions

View File

@ -65,6 +65,11 @@ else
JAVA=`which java`
fi
if [ ! -x "$JAVA" ]; then
echo "Could not find any executable java binary. Please install java in your PATH or set JAVA_HOME"
exit 1
fi
# real getopt cannot be used because we need to hand options over to the PluginManager
while [ $# -gt 0 ]; do
case $1 in

View File

@ -72,6 +72,17 @@ setup() {
verify_archive_installation
}
@test "[TAR] elasticsearch fails if java executable is not found" {
local JAVA=$(which java)
sudo chmod -x $JAVA
run "$ESHOME/bin/elasticsearch"
sudo chmod +x $JAVA
[ "$status" -eq 1 ]
[[ "$output" == *"Could not find any executable java binary. Please install java in your PATH or set JAVA_HOME"* ]]
}
##################################
# Check that Elasticsearch is working
##################################

View File

@ -131,6 +131,18 @@ fi
remove_jvm_example
}
@test "[$GROUP] fail if java executable is not found" {
[ "$GROUP" == "TAR PLUGINS" ] || skip "Test case only supported by TAR PLUGINS"
local JAVA=$(which java)
sudo chmod -x $JAVA
run "$ESHOME/bin/plugin"
sudo chmod +x $JAVA
[ "$status" -eq 1 ]
[[ "$output" == *"Could not find any executable java binary. Please install java in your PATH or set JAVA_HOME"* ]]
}
# 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" {