|
@@ -3,9 +3,14 @@
|
|
|
# This file is used to test the elasticsearch init.d scripts.
|
|
|
|
|
|
# WARNING: This testing file must be executed as root and can
|
|
|
-# dramatically change your system. It removes the 'elasticsearch'
|
|
|
-# user/group and also many directories. Do not execute this file
|
|
|
-# unless you know exactly what you are doing.
|
|
|
+# 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
|
|
|
+}
|
|
|
|
|
|
# The test case can be executed with the Bash Automated
|
|
|
# Testing System tool available at https://github.com/sstephenson/bats
|
|
@@ -60,11 +65,11 @@ setup() {
|
|
|
@test "[INIT.D] elasticsearch fails if startup script is not executable" {
|
|
|
local INIT="/etc/init.d/elasticsearch"
|
|
|
local DAEMON="$ESHOME/bin/elasticsearch"
|
|
|
-
|
|
|
+
|
|
|
sudo chmod -x "$DAEMON"
|
|
|
run "$INIT"
|
|
|
sudo chmod +x "$DAEMON"
|
|
|
-
|
|
|
+
|
|
|
[ "$status" -eq 1 ]
|
|
|
[[ "$output" == *"The elasticsearch startup script does not exists or it is not executable, tried: $DAEMON"* ]]
|
|
|
}
|