]> git.ipfire.org Git - thirdparty/bacula.git/commitdiff
BEE Backport regress/tests/virtual-deleted-files-test
authorEric Bollengier <eric@baculasystems.com>
Wed, 2 Sep 2020 13:37:25 +0000 (15:37 +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@baculasystems.com>
Date:   Wed Apr 10 08:24:54 2019 +0200

    regress: Fix virtual-deleted-files-test

Author: Eric Bollengier <eric@baculasystems.com>
Date:   Mon Apr 1 12:08:33 2019 +0200

    regress: Add test for virtual full issue bacula.org#2367

regress/tests/virtual-deleted-files-test [new file with mode: 0755]

diff --git a/regress/tests/virtual-deleted-files-test b/regress/tests/virtual-deleted-files-test
new file mode 100755 (executable)
index 0000000..f7ce901
--- /dev/null
@@ -0,0 +1,76 @@
+#!/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 
+#   Virtual Full backup to another device. We test if we restore
+#   deleted files after a set of virtualfull
+#
+# This script uses the disk autochanger
+#
+TestName="virtual-deleted-files-test"
+JobName=Vbackup
+. scripts/functions
+
+
+scripts/cleanup
+scripts/copy-migration-confs
+echo "${cwd}/build" >${cwd}/tmp/file-list
+
+rm -f $cwd/build/inc1 $cwd/build/inc2 $cwd/build/diff1
+
+change_jobname NightlySave $JobName
+start_test
+
+# We do a first full backup, then 2 incr, then we merge the two incremental
+# jobs, then we restore and compare.
+
+# Write out bconsole commands
+cat <<END_OF_DATA >${cwd}/tmp/bconcmds
+@output /dev/null
+messages
+@$out ${cwd}/tmp/log1.out
+@#setdebug level=100 storage=File
+label storage=File volume=FileVolume001 Pool=Default
+label storage=DiskChanger volume=ChangerVolume001 slot=1 Pool=Full drive=0
+label storage=DiskChanger volume=ChangerVolume002 slot=2 Pool=Full drive=0
+@# run several jobs
+@exec "sh -c 'date > ${cwd}/build/date'"
+run job=$JobName level=Full accurate=yes yes
+wait
+messages
+list jobs
+@exec "sh -c 'touch ${cwd}/build/inc1'"
+@exec "sh -c 'touch ${cwd}/build/inc2'"
+run job=$JobName level=Incremental accurate=yes yes
+wait
+messages
+@exec "sh -c 'rm -f ${cwd}/build/date'"
+@exec "sh -c 'rm -f ${cwd}/build/inc2'"
+run job=$JobName level=Incremental accurate=yes yes
+wait
+messages
+list jobs
+run job=$JobName jobid=2,3 level=VirtualFull accurate=yes yes
+wait
+messages
+delete jobid=2,3
+@# 
+@# now do a restore of the consolidated Full
+@#
+@$out $tmp/log2.out
+restore where=${cwd}/tmp/bacula-restores select all done yes
+wait
+messages
+quit
+END_OF_DATA
+
+run_bacula
+check_for_zombie_jobs storage=File
+
+stop_bacula
+check_two_logs
+check_restore_diff
+
+end_test