#!/bin/bash
set -e
set -o pipefail
set -u

TestName="$(basename "$(pwd)")"
export TestName

#shellcheck source=../../environment.in
. ./environment

#shellcheck source=../../scripts/functions
. "${BAREOS_SCRIPTS_DIR}"/functions

#
# Run test to check correct output of `status dir days=45`,
# i.e. whether the job 'LastSundayJob' is listed as scheduled
#

start_test

log="$tmp"/last_keyword_log.out

cat <<END_OF_DATA >$tmp/bconcmds
messages
@$out $log
status dir days=45
wait
messages
quit
END_OF_DATA

run_bconsole

# check that `status dir days=45` lists 'LastSundayJob' as scheduled
expect_grep "LastSundayJob .*" \
  "$log" \
  "LastSundayJob is not listed as scheduled in 'status dir days=45' but it should!"

end_test
