From 27b5142de6274ca1b9236d999c2878ee4c218e0a Mon Sep 17 00:00:00 2001 From: Alexander Reelsen Date: Mon, 12 Jun 2017 13:56:26 +0200 Subject: [PATCH] Watcher: Fix croneval tool for packaging (elastic/x-pack-elasticsearch#1689) The croneval script used an old parameter to start up. This commit removes this parameter, that is used, when a package is used. In addition a concrete vagrant test has been added. relates elastic/x-pack-elasticsearch#1635 Original commit: elastic/x-pack-elasticsearch@ea7b8a08f449de1a95ce2a1b58e81883cab47a53 --- plugin/bin/x-pack/croneval | 4 ---- .../src/test/resources/packaging/tests/10_basic.bats | 11 ++++++++++- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/plugin/bin/x-pack/croneval b/plugin/bin/x-pack/croneval index 422680520dc..c35d874559f 100755 --- a/plugin/bin/x-pack/croneval +++ b/plugin/bin/x-pack/croneval @@ -93,10 +93,6 @@ fi declare -a args=("$@") -if [ -e "$CONF_DIR" ]; then - args=("${args[@]}" -Edefault.path.conf="$CONF_DIR") -fi - cd "$ES_HOME" > /dev/null "$JAVA" $ES_JAVA_OPTS -cp "$ES_CLASSPATH" -Des.path.home="$ES_HOME" org.elasticsearch.xpack.watcher.trigger.schedule.tool.CronEvalTool "${args[@]}" status=$? diff --git a/qa/vagrant/src/test/resources/packaging/tests/10_basic.bats b/qa/vagrant/src/test/resources/packaging/tests/10_basic.bats index 30c91ea94c2..28d653dd16f 100644 --- a/qa/vagrant/src/test/resources/packaging/tests/10_basic.bats +++ b/qa/vagrant/src/test/resources/packaging/tests/10_basic.bats @@ -49,4 +49,13 @@ setup() { assert_file "$ESCONFIG/x-pack/roles.yml" f elasticsearch elasticsearch 660 assert_file "$ESCONFIG/x-pack/role_mapping.yml" f elasticsearch elasticsearch 660 assert_file "$ESCONFIG/x-pack/log4j2.properties" f elasticsearch elasticsearch 660 -} \ No newline at end of file +} + +@test "[X-PACK] verify croneval works" { + run $ESHOME/bin/x-pack/croneval "0 0 20 ? * MON-THU" -c 2 + [ "$status" -eq 0 ] + [[ "$output" == *"Valid!"* ]] || { + echo "Expected output message to contain [Valid!] but found: $output" + false + } +}