]> git.ipfire.org Git - thirdparty/bacula.git/commitdiff
regress: Add sd-packet-check-test
authorEric Bollengier <eric@baculasystems.com>
Fri, 5 Mar 2021 17:55:38 +0000 (18:55 +0100)
committerEric Bollengier <eric@baculasystems.com>
Thu, 24 Mar 2022 08:03:01 +0000 (09:03 +0100)
regress/tests/sd-packet-check-test [new file with mode: 0755]

diff --git a/regress/tests/sd-packet-check-test b/regress/tests/sd-packet-check-test
new file mode 100755 (executable)
index 0000000..fa6f067
--- /dev/null
@@ -0,0 +1,91 @@
+#!/bin/bash
+#
+# Copyright (C) 2000-2021 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
+# Test the SDPacketCheck feature
+#
+TestName="sd-packet-check-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
+
+nbpacket=10
+
+$bperl -e "add_attribute('$conf/bacula-fd.conf', 'SDPacketCheck', '$nbpacket', 'FileDaemon')"
+
+change_jobname BackupClient1 $JobName
+start_test
+
+cat <<END_OF_DATA >$tmp/bconcmds
+@output /dev/null
+messages
+@$out $tmp/log1.out
+setdebug level=10 tags=network trace=1 options=c client
+label volume=TestVolume001 storage=File1 pool=File slot=1 drive=0
+run job=$JobName yes
+wait
+messages
+@# 
+@# now do a restore
+@#
+@$out $tmp/log2.out  
+restore where=$tmp/bacula-restores select all done
+yes
+wait
+messages
+quit
+END_OF_DATA
+
+run_bacula
+
+cat <<END_OF_DATA >$tmp/bconcmds
+@$out /dev/null
+messages
+@$out $tmp/log1.out
+run job=$JobName yes
+wait
+messages
+@# 
+@# now do a restore
+@#
+@$out $tmp/log2.out  
+#setbandwidth client=$CLIENT limit="100 kb/s"
+restore where=$tmp/bacula-restores select all done
+yes
+wait
+messages
+quit
+END_OF_DATA
+
+#
+# Now do a second backup after making a few changes
+#
+touch ${cwd}/build/src/dird/*.o
+echo "test test" > ${cwd}/build/src/dird/xxx
+#
+
+grep "Request a POLL after $nbpacket packets..." $working/*fd.trace > /dev/null
+if [ $? != 0 ]; then
+    print_debug "ERROR: Should find a POLL request in $working/*fd.trace"
+    estat=1
+fi
+
+run_bconsole
+check_for_zombie_jobs storage=File1
+stop_bacula
+
+check_two_logs
+check_restore_diff
+end_test