From 433d073d1c9dc3c9f9efdb57e2654f4e819ea49e Mon Sep 17 00:00:00 2001 From: Eric Bollengier Date: Mon, 31 Oct 2022 15:54:41 +0100 Subject: [PATCH] regress: Add test for status dir schedule output --- regress/tests/many-schedule-test | 101 +++++++++++++++++++++++++++++++ 1 file changed, 101 insertions(+) create mode 100755 regress/tests/many-schedule-test diff --git a/regress/tests/many-schedule-test b/regress/tests/many-schedule-test new file mode 100755 index 000000000..5fba5bacb --- /dev/null +++ b/regress/tests/many-schedule-test @@ -0,0 +1,101 @@ +#!/bin/sh +# +# Copyright (C) 2000-2021 Kern Sibbald +# Copyright (C) 2021-2022 Bacula Systems SA +# License: BSD 2-Clause; see file LICENSE-FOSS +# + +# +# Attempt to schedule thousand of jobs +# +TestName="many-schedule-test" +JobName=ScheduleTest +. scripts/functions + +scripts/cleanup +scripts/copy-test-confs +echo "${cwd}/build/po" >${cwd}/tmp/file-list + + +# Generate a Schedule to run a lot of jobs +cat <> $conf/bacula-dir.conf +Schedule { + Name = AllTheTime +EOF + +for i in `seq 0 23`; do + for j in `seq 0 59`; do + printf "Run = Level=Full mon-sun at %02i:%02i\n" $i $j >> $conf/bacula-dir.conf + done +done + +echo "}" >> $conf/bacula-dir.conf + +start_test + +$bperl -e "add_attribute('$conf/bacula-dir.conf', 'Schedule', 'AllTheTime', 'Job', 'NightlySave')" + + +cat <${cwd}/tmp/bconcmds +@output /dev/null +messages +@$out $tmp/log1.out +label storage=File volume=TestVolume001 slot=1 drive=0 pool=Default +@output $tmp/l1.out +.status dir scheduled +@output $tmp/l2.out +status scheduled +@output $tmp/l3.out +.api 2 api_opts=j +.status dir scheduled +@output $tmp/l4.out +status schedule +@output $tmp/l5.out +.status dir scheduled limit=10 +@output $tmp/l6.out +status schedule limit=10 +quit +END_OF_DATA + +run_bacula + +grep '{' $tmp/l3.out | perl -MJSON -e 'decode_json(<>)' +if [ $? -ne 0 ]; then + print_debug "ERROR: Unable to decode JSON in $tmp/l3.out" + estat=1 +fi + +grep '{' $tmp/l4.out | perl -MJSON -e 'decode_json(<>)' +if [ $? -ne 0 ]; then + print_debug "ERROR: Unable to decode JSON in $tmp/l4.out" + estat=1 +fi + +grep '{' $tmp/l5.out | perl -MJSON -e 'decode_json(<>)' +if [ $? -ne 0 ]; then + print_debug "ERROR: Unable to decode JSON in $tmp/l5.out" + estat=1 +fi + +grep '{' $tmp/l6.out | perl -MJSON -e 'decode_json(<>)' +if [ $? -ne 0 ]; then + print_debug "ERROR: Unable to decode JSON in $tmp/l6.out" + estat=1 +fi + +cat <${cwd}/tmp/bconcmds +@output /dev/null +messages +disable schedule=AllTheTime +cancel all yes +wait +messages +quit +END_OF_DATA + +run_bconsole + +check_for_zombie_jobs storage=File1 +stop_bacula + +end_test -- 2.47.3