]> git.ipfire.org Git - thirdparty/bacula.git/commitdiff
BEE Backport regress/tests/vtape-autoselect-changer
authorEric Bollengier <eric@baculasystems.com>
Wed, 2 Sep 2020 13:38:25 +0000 (15:38 +0200)
committerEric Bollengier <eric@baculasystems.com>
Thu, 24 Mar 2022 08:02:56 +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: Eric Bollengier <eric@eb.homelinux.org>
Date:   Fri Aug 19 13:45:29 2011 +0200

    regress: Add test to show AutoSelect=no problem

regress/tests/vtape-autoselect-changer [new file with mode: 0755]

diff --git a/regress/tests/vtape-autoselect-changer b/regress/tests/vtape-autoselect-changer
new file mode 100755 (executable)
index 0000000..4303c97
--- /dev/null
@@ -0,0 +1,85 @@
+#!/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)
+#
+# TAPE_DRIVE="$cwd/working/ach/drive0"
+# TAPE_DRIVE1="$cwd/working/ach/drive0"
+# AUTOCHANGER="$cwd/working/ach/conf"
+# USE_VTAPE=yes
+# AUTOCHANGER_SCRIPT=disk-changer
+# 
+
+TestName="vtape-autoselect-changer"
+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" >${cwd}/tmp/file-list
+$bperl -e "add_attribute('$conf/bacula-sd.conf', 'AutoSelect', 'no', 'Device', 'LTO3_0')"
+
+
+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
+@$out /dev/null
+messages
+@$out $tmp/log1.out
+@# use LTO3_1 to label volumes
+label barcodes pool=Scratch slots=1-14 storage=LTO3 drive=1
+yes
+umount storage=LTO3_1 drive=1
+mount storage=LTO3_1 drive=1 slot=0
+messages
+run storage=LTO3 job=NightlySave1 pool=Default yes
+wait
+umount storage=LTO3_1 drive=1
+mount storage=LTO3_1 drive=1 slot=0
+messages
+quit
+END_OF_DATA
+
+run_bacula
+
+touch ${cwd}/build/po/*.po
+
+cat <<END_OF_DATA >${cwd}/tmp/bconcmds
+@$out $tmp/log2.out
+restore client=$clientname storage=LTO3_0 where=${cwd}/tmp/bacula-restores select all done yes
+wait
+messages
+@$out $tmp/log3.out
+run storage=LTO3 job=NightlySave1 pool=Default  yes
+wait
+messages
+END_OF_DATA
+
+run_bconsole
+
+check_two_logs
+#check_restore_diff
+
+grep 'Using Device "LTO3_0"' $tmp/log3.out > /dev/null
+if [ $? = 0 ]; then
+    print_debug "ERROR: in $tmp/log3.out, the backup job shouldn't use LTO3_0 which is autoselect=no"
+    bstat=1
+fi
+
+end_test