]> git.sur5r.net Git - bacula/bacula/commitdiff
regress: Add prune test for copy jobs
authorEric Bollengier <eric@eb.homelinux.org>
Sun, 20 Jun 2010 09:50:35 +0000 (11:50 +0200)
committerEric Bollengier <eric@eb.homelinux.org>
Sun, 20 Jun 2010 09:51:06 +0000 (11:51 +0200)
regress/tests/prune-copy-test [new file with mode: 0755]

diff --git a/regress/tests/prune-copy-test b/regress/tests/prune-copy-test
new file mode 100755 (executable)
index 0000000..93505f9
--- /dev/null
@@ -0,0 +1,84 @@
+#!/bin/sh
+#
+# Run a simple backup of the Bacula build directory then copy it
+#   to another device.
+#
+# This script uses the virtual disk autochanger
+#
+TestName="copy-job-test"
+JobName=CopyJobSave
+. scripts/functions
+
+
+scripts/cleanup
+scripts/copy-migration-confs
+scripts/prepare-disk-changer
+echo "${cwd}/build" >${cwd}/tmp/file-list
+sed 's/migrate/copy/g' ${cwd}/bin/bacula-dir.conf > ${cwd}/tmp/1
+sed 's/Migrate/Copy/g' ${cwd}/tmp/1 > ${cwd}/bin/bacula-dir.conf
+
+dircfg=$conf/bacula-dir.conf
+$bperl -e "add_attribute('$dircfg', 'AutoPrune', 'No', 'Client')"
+$bperl -e "add_attribute('$dircfg', 'Job Retention', '1s', 'Client')"
+
+change_jobname NightlySave $JobName
+start_test
+
+#
+# Note, we first backup into Pool Default, 
+#          then Copy into Pool Full. 
+#              Pool Default uses Storage=File
+#              Pool Full    uses Storage=DiskChanger
+
+# Write out bconsole commands
+cat <<END_OF_DATA >${cwd}/tmp/bconcmds
+@$out /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 two jobs (both will be copied)
+run job=$JobName yes
+run job=$JobName yes
+wait
+list jobs
+list volumes
+@#setdebug level=100 dir
+@# should copy two jobs
+@#setdebug level=51 storage=DiskChanger
+run job=copy-job yes
+wait
+messages
+@#purge volume=FileVolume001
+list jobs 
+list volumes
+wait
+messages
+@$out ${cwd}/tmp/log3.out
+@#
+@# Now do another backup, but level Incremental
+@#
+run job=$JobName level=Incremental yes
+wait
+messages
+@#
+@# This final job that runs should be Incremental and
+@# not upgraded to full.
+list jobs
+messages
+quit
+END_OF_DATA
+
+run_bacula
+check_for_zombie_jobs storage=File
+stop_bacula
+
+touch $tmp/log2.out
+check_two_logs
+
+$bperl -e "check_job_list('$tmp/log3.out',1,3,4,5,6,7)"
+estat=$(($estat + $?))
+
+end_test