]> git.ipfire.org Git - thirdparty/bacula.git/commitdiff
BEE Backport regress/tests/upgrade-to-full-test
authorEric Bollengier <eric@baculasystems.com>
Wed, 2 Sep 2020 12:59:39 +0000 (14:59 +0200)
committerEric Bollengier <eric@baculasystems.com>
Tue, 1 Mar 2022 14:36:18 +0000 (15:36 +0100)
This commit is the result of the squash of the following main commits:

Author: Eric Bollengier <eric@baculasystems.com>
Date:   Tue Jul 21 10:28:13 2020 +0200

    regress: Add copyright to regress scripts

Author: Eric Bollengier <eric@baculasystems.com>
Date:   Thu Mar 28 10:04:17 2019 +0100

    regress: Add test to check messages when upgrading to full

regress/tests/upgrade-to-full-test [new file with mode: 0755]

diff --git a/regress/tests/upgrade-to-full-test b/regress/tests/upgrade-to-full-test
new file mode 100755 (executable)
index 0000000..aa4f5d8
--- /dev/null
@@ -0,0 +1,87 @@
+#!/bin/sh
+#
+# Copyright (C) 2000-2020 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
+# Run a simple backup of the Bacula build directory
+#   then do a couple of new jobs to see what bacula prints
+#   when upgrading a job
+#
+TestName="upgrade-test"
+JobName=backup
+. scripts/functions
+
+scripts/cleanup
+scripts/copy-confs
+
+#
+# Zap out any schedule in default conf file so that
+#  it doesn't start during our test
+#
+outf="$tmp/sed_tmp"
+echo "s%  Schedule =%# Schedule =%g" >${outf}
+cp $scripts/bacula-dir.conf $tmp/1
+sed -f ${outf} $tmp/1 >$scripts/bacula-dir.conf
+
+change_jobname BackupClient1 $JobName
+start_test
+
+
+cat <<END_OF_DATA >$tmp/bconcmds
+@output /dev/null
+messages
+@$out $tmp/log1.out
+setdebug level=4 storage=File1
+label volume=TestVolume001 storage=File1 pool=File slot=1 drive=0
+run job=$JobName yes
+wait
+messages
+@$out $tmp/log2.out
+@# Modify the fileset, should display a message with the fileset
+@exec "sed -i s:build:build/po: $conf/bacula-dir.conf"
+reload
+run job=$JobName yes
+wait
+messages
+quit
+END_OF_DATA
+
+run_bacula
+check_for_zombie_jobs storage=File1
+
+$bperl -e "add_attribute('$conf/bacula-dir.conf', 'MaxFullInterval', '2s', 'Job')"
+
+cat <<END_OF_DATA >$tmp/bconcmds
+@$out $tmp/log3.out
+reload
+@sleep 3
+run job=$JobName yes
+wait
+messages
+quit
+END_OF_DATA
+
+run_bconsole
+
+stop_bacula
+
+grep "No prior or suitable Full backup found in catalog." $tmp/log1.out > /dev/null
+if [ $? != 0 ]; then
+    print_debug "ERROR: The first job should display a message in $tmp/log1.out"
+    estat=1
+fi
+
+grep "No prior or suitable Full backup found in catalog for the current FileSet." $tmp/log2.out > /dev/null
+if [ $? != 0 ]; then
+    print_debug "ERROR: After the fileset modification, the message should be clear in $tmp/log2.out"
+    estat=2
+fi
+
+grep "Max Full Interval" $tmp/log3.out > /dev/null
+if [ $? != 0 ]; then
+    print_debug "ERROR: After Max Full Interval in $tmp/log3.out"
+    estat=3
+fi
+
+
+end_test