]> git.ipfire.org Git - thirdparty/bacula.git/commitdiff
regress: virtual-backup-test add XPARAM USE_SCHEDULER
authorAlain Spineux <alain@baculasystems.com>
Mon, 19 Oct 2020 16:28:56 +0000 (18:28 +0200)
committerEric Bollengier <eric@baculasystems.com>
Thu, 24 Mar 2022 08:02:58 +0000 (09:02 +0100)
- use : USE_SCHEDULER=yes tests/virtual-backup-test
  to run the program via the scheduler instead of the "run" command
  the scheduler fire the job maximum 2min after the start of the program

regress/tests/virtual-backup-test

index 450bac05a7c76a76ccd7ba210b016d5c20a4ba6d..2e8413a74edecc8ffec6122422420faf5e77687c 100755 (executable)
 #
 # This script uses the disk autochanger
 #
+# XPARAM USE_SCHEDULER=(no|yes)
+#   if yes then schedule the job for 2min in the future instead of using a "run"
+#
 TestName="virtual-backup-test"
 JobName=Vbackup
 . scripts/functions
 
-
 scripts/cleanup
 scripts/copy-migration-confs
 scripts/prepare-disk-changer
 echo "${cwd}/build" >${cwd}/tmp/file-list
 
 change_jobname NightlySave $JobName
+
+USE_SCHEDULER=${USE_SCHEDULER:-no}
+if [ "$USE_SCHEDULER" = "yes" ] ; then
+   $bperl -e "add_attribute('$conf/bacula-dir.conf', 'Schedule', 'Vbackup', 'Job', 'Vbackup')"
+   now_plus_2min=`python -c "import time; print(time.strftime('%H:%M', time.localtime(time.time()+119)))"`
+   echo $conf/bacula-dir.conf
+   cat >> $conf/bacula-dir.conf <<EOF
+
+Schedule {
+  Name = "Vbackup"
+  Run =  Level="VirtualFull" at $now_plus_2min
+}
+EOF
+   RUN_OR_WAIT_SCHEDULER="@sleep 119"
+else
+   RUN_OR_WAIT_SCHEDULER="run job=$JobName level=VirtualFull yes"
+fi
+
 start_test
 
 #
@@ -74,7 +94,7 @@ list volumes
 @# should Consolidate Full, Differential and Incremental
 @#setdebug level=150 storage=DiskChanger
 @#setdebug level=100 dir
-run job=$JobName level=VirtualFull yes
+$RUN_OR_WAIT_SCHEDULER
 wait
 messages
 list volumes