]> git.ipfire.org Git - thirdparty/bacula.git/commitdiff
BEE Backport regress/tests/reload-many-test
authorEric Bollengier <eric@baculasystems.com>
Wed, 2 Sep 2020 13:32:00 +0000 (15:32 +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:   Tue Dec 5 23:49:44 2017 +0100

    regress: Fix reload-many-test with the new reload error message

Author: Eric Bollengier <eric@baculasystems.com>
Date:   Tue Feb 14 10:10:33 2017 +0100

    Modify the setbandwidth limit parameter to accept speed input. The default is no longer kb/s but b/s. ex: limit=10kb/s

Author: Eric Bollengier <eric@baculasystems.com>
Date:   Thu Feb 9 10:02:05 2017 +0100

    regress: Fix reload-many-test

    The Backup/Restore logs are not reported in the right log1/log2.out. We are not
    really looking for job status.

Author: Kern Sibbald <kern@sibbald.com>
Date:   Fri Jul 17 09:36:22 2015 +0200

    Tweak reload-many-test

Author: Kern Sibbald <kern@sibbald.com>
Date:   Fri Dec 21 12:44:44 2012 +0100

    Pull reload-many-test from Branch-6.2

Author: Kern Sibbald <kern@sibbald.com>
Date:   Tue Oct 23 18:52:29 2012 +0200

    Drop previous regression test output

Author: Eric Bollengier <eric@baculasystems.com>
Date:   Thu Jul 12 08:59:01 2012 +0200

    regress: Add test for maximum reload requests

Author: Eric Bollengier <eric@baculasystems.com>
Date:   Wed Jul 11 08:59:10 2012 +0200

    regress: Fix the reload-many-test

Author: Eric Bollengier <eric@baculasystems.com>
Date:   Mon Jul 9 11:38:04 2012 +0200

    regress: Add test for reload issue

regress/tests/reload-many-test [new file with mode: 0755]

diff --git a/regress/tests/reload-many-test b/regress/tests/reload-many-test
new file mode 100755 (executable)
index 0000000..66cfdec
--- /dev/null
@@ -0,0 +1,169 @@
+#!/bin/sh
+#
+# Copyright (C) 2000-2020 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
+# Do a good number of reload and test MaximumReloadRequests
+#
+TestName="reload-many-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
+
+$bperl -e 'add_attribute("$conf/bacula-dir.conf", "MaximumReloadRequests", "40", "Director")'
+
+change_jobname BackupClient1 $JobName
+start_test
+
+cat <<END_OF_DATA >$tmp/bconcmds
+@$out /dev/null
+messages
+@$out $tmp/log1.out
+setdebug level=100 trace=1 dir
+label volume=TestVolume001 storage=File1 pool=File slot=1 drive=0
+setbandwidth limit="100 kb/s" client
+run job=$JobName yes
+@sleep 1
+reload
+reload
+reload
+reload
+run job=$JobName yes
+reload
+reload
+reload
+reload
+reload
+reload
+reload
+run job=$JobName yes
+reload
+reload
+reload
+reload
+reload
+reload
+reload
+run job=$JobName yes
+reload
+reload
+reload
+reload
+reload
+reload
+run job=$JobName yes
+reload
+reload
+reload
+reload
+reload
+reload
+reload
+reload
+run job=$JobName yes
+reload
+reload
+reload
+reload
+reload
+reload
+reload
+reload
+messages
+@# Should print errros after 40 reload
+@$out $tmp/log2.out
+@exec "sh -c 'cat $tmp/log >> $tmp/log1.out'"
+@exec "cp /dev/null $tmp/log"
+reload
+reload
+reload
+reload
+reload
+reload
+reload
+reload
+reload
+reload
+reload
+reload
+setbandwidth limit="100000 kb/s" client
+wait
+messages
+@exec "sh -c 'cat $tmp/log >> $tmp/log2.out'"
+@exec "cp /dev/null $tmp/log"
+END_OF_DATA
+
+run_bacula
+
+cat <<END_OF_DATA >$tmp/bconcmds.1
+@sleep 3
+@$out $tmp/log3.out
+status dir
+reload
+reload
+reload
+reload
+reload
+reload
+reload
+reload
+reload
+reload
+reload
+reload
+messages
+quit
+END_OF_DATA
+
+sed 's/log3.out/log4.out/' $tmp/bconcmds.1 > $tmp/bconcmds.2
+sed 's/log3.out/log5.out/' $tmp/bconcmds.1 > $tmp/bconcmds.3
+
+run_bconsole $tmp/bconcmds.1 &
+run_bconsole $tmp/bconcmds.2 &
+run_bconsole $tmp/bconcmds.3
+
+wait        # wait for first run_bconsole
+wait        # wait for the second run_bconsole
+
+check_for_zombie_jobs storage=File1
+stop_bacula
+
+touch $tmp/log2.out
+
+grep 'Too many .* open reload requests' $tmp/log1.out > /dev/null
+if [ $? = 0 ]; then
+    print_debug "ERROR: should NOT find error on reload request in $tmp/log1.out"
+    estat=1
+fi
+
+grep 'Too many .* open reload requests' $tmp/log2.out > /dev/null
+if [ $? != 0 ]; then
+    print_debug "ERROR: should find error on reload request in $tmp/log2.out"
+    estat=1
+fi
+
+grep 'Too many .* open reload requests' $tmp/log3.out > /dev/null
+if [ $? = 0 ]; then
+    print_debug "ERROR: should NOT find error on reload request after the end of the job $tmp/log3.out"
+    estat=1
+fi
+
+# This part looks to be hard to trig
+# grep 'Already doing a reload request' $tmp/log3.out $tmp/log4.out $tmp/log > /dev/null
+# if [ $? != 0 ]; then
+#     print_debug "ERROR: should find a message about reload conflict"
+#     estat=1
+# fi
+
+end_test