1 #!/usr/bin/env bats 2 3 # Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one 4 # or more contributor license agreements. Licensed under the Elastic License; 5 # you may not use this file except in compliance with the Elastic License. 6 7 # This file is used to test the X-Pack package. 8 9 # WARNING: This testing file must be executed as root and can 10 # dramatically change your system. It removes the 'elasticsearch' 11 # user/group and also many directories. Do not execute this file 12 # unless you know exactly what you are doing. 13 14 load $BATS_UTILS/utils.bash 15 load $BATS_UTILS/tar.bash 16 load $BATS_UTILS/plugins.bash 17 load $BATS_UTILS/xpack.bash 18 19 setup() { 20 skip_not_tar_gz 21 export ESHOME=/tmp/elasticsearch 22 export PACKAGE_NAME="elasticsearch" 23 export_elasticsearch_paths 24 export ESPLUGIN_COMMAND_USER=elasticsearch 25 } 26 27 @test "[X-PACK] install default distribution" { 28 # Cleans everything for the 1st execution 29 clean_before_test 30 31 # Install the archive 32 install_archive 33 } 34 35 @test "[X-PACK] verify x-pack installation" { 36 verify_xpack_installation 37 } 38 39 @test "[X-PACK] verify croneval works" { 40 run $ESHOME/bin/elasticsearch-croneval "0 0 20 ? * MON-THU" -c 2 41 [ "$status" -eq 0 ] 42 [[ "$output" == *"Valid!"* ]] || { 43 echo "Expected output message to contain [Valid!] but found: $output" 44 false 45 } 46 }