]> git.ipfire.org Git - thirdparty/bacula.git/commitdiff
BEE Backport regress/tests/shared-storage-test
authorEric Bollengier <eric@baculasystems.com>
Wed, 2 Sep 2020 13:33:31 +0000 (15:33 +0200)
committerEric Bollengier <eric@baculasystems.com>
Thu, 24 Mar 2022 08:02:55 +0000 (09:02 +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: 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:   Mon Feb 27 18:30:19 2012 +0100

    regress: Add test for new shared storage directive

regress/tests/shared-storage-test [new file with mode: 0755]

diff --git a/regress/tests/shared-storage-test b/regress/tests/shared-storage-test
new file mode 100755 (executable)
index 0000000..928cbf5
--- /dev/null
@@ -0,0 +1,107 @@
+#!/bin/sh
+#
+# Copyright (C) 2000-2020 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
+# Run backups with dummy tape driver
+# This test setups an Autochanger with 80 slots
+# and 5 drives (3 LTO3 and 2 LTO1)
+#
+# USE_VTAPE=yes
+
+TestName="shared-storage-test"
+JobName=backup
+. scripts/functions
+
+require_vtape
+
+scripts/cleanup
+scripts/copy-tape-confs
+cp $rscripts/bacula-dir-vtape.conf $conf/bacula-dir.conf
+cp $rscripts/bacula-sd-vtape.conf $conf/bacula-sd.conf
+scripts/prepare-fake-autochanger
+
+echo "${cwd}/build/po" >${cwd}/tmp/file-list
+
+# change SharedStorage from yes to no to test the regular env
+$bperl -e "add_attribute('$conf/bacula-dir.conf', 'SharedStorage', 'no', 'Director')"
+
+$bperl -e "add_attribute('$conf/bacula-dir.conf', 'MaxWaitTime', '10sec', 'Job')"
+
+start_test
+
+clientname=`awk '/Name = .*-fd/ { if (!ok) { print $3 ; ok=1 } }' bin/bacula-dir.conf`
+
+# Catalog record for cleaning tape "CLN01" successfully created.
+# CLN01      | Cleaning
+
+# Write out bconsole commands
+cat <<END_OF_DATA >${cwd}/tmp/bconcmds
+@output /dev/null
+setdebug level=50 dir trace=1
+messages
+@$out $tmp/log6.out
+@#setdebug level=200 storage=LTO1
+label barcodes pool=Scratch slots=1-4 storage=LTO3 drive=0
+yes
+messages
+list volumes
+@$out ${cwd}/tmp/log1.out
+run storage=LTO3_0 job=NightlySave  pool=Inc     yes
+run storage=LTO3_0 job=NightlySave2 pool=Full    yes
+run storage=LTO3_0 job=NightlySave1 pool=Default yes
+wait
+messages
+quit
+END_OF_DATA
+
+run_bacula
+
+# test update slots
+# remove volume vol1 from autochanger
+grep -v vol1 $working/ach/barcodes > $tmp/1
+cp $tmp/1 $working/ach/barcodes
+mv $working/ach/slot1 $working/ach/slot1.dis
+
+# With SharedStorage=yes it will use vol4, with SharedStorage=no, it will ask
+# to load vol1 and fail
+
+cat <<END_OF_DATA >${cwd}/tmp/bconcmds
+@$out $tmp/log3.out
+update slots=1-4 storage=LTO3 drive=0
+llist volumes=vol1
+@$out $tmp/log4.out
+update slots=1-4 storage=LTO3_0 drive=0
+llist volumes=vol1
+@$out $tmp/log1.out
+run storage=LTO3_1 job=NightlySave  pool=Inc     yes
+run storage=LTO3_1 job=NightlySave2 pool=Full    yes
+run storage=LTO3_1 job=NightlySave1 pool=Default yes
+wait
+messages
+quit
+END_OF_DATA
+
+touch $tmp/log2.out
+
+run_bconsole
+check_for_zombie_jobs storage=LTO3 client=$clientname
+
+stop_bacula
+
+check_two_logs
+
+grep "inchanger: 0" $tmp/log3.out > /dev/null
+if [ $? != 0 ]; then
+    print_debug "ERROR bad inchanger status after update slots"
+    # show the update slots bug
+fi
+
+grep "inchanger: 0" $tmp/log4.out > /dev/null
+if [ $? != 0 ]; then
+    print_debug "ERROR bad inchanger status after update slots"
+    estat=1
+fi
+
+end_test