From cf7b513225d705c0e83d4b9598f320a536424304 Mon Sep 17 00:00:00 2001 From: Eric Bollengier Date: Sun, 20 Jun 2010 11:41:56 +0200 Subject: [PATCH] regress: Add prune test for migration jobs --- regress/tests/prune-migration-test | 98 ++++++++++++++++++++++++++++++ 1 file changed, 98 insertions(+) create mode 100755 regress/tests/prune-migration-test diff --git a/regress/tests/prune-migration-test b/regress/tests/prune-migration-test new file mode 100755 index 0000000000..7b200874f9 --- /dev/null +++ b/regress/tests/prune-migration-test @@ -0,0 +1,98 @@ +#!/bin/sh +# +# Run a simple backup of the Bacula build directory then migrate it +# to another device, then see how prune code handle that +# +# This script uses the virtual disk autochanger +# +TestName="prune-migration-test" +JobName=MigrationJobSave +. scripts/functions + + +scripts/cleanup +scripts/copy-migration-confs +scripts/prepare-disk-changer +echo "${cwd}/build" >${cwd}/tmp/file-list + +change_jobname NightlySave $JobName +dircfg=$conf/bacula-dir.conf +$bperl -e "add_attribute('$dircfg', 'AutoPrune', 'No', 'Client')" +$bperl -e "add_attribute('$dircfg', 'Job Retention', '1s', 'Client')" + +start_test + +# +# Note, we first backup into Pool Default, +# then Migrate into Pool Full. +# Pool Default uses Storage=File +# Pool Full uses Storage=DiskChanger + +# Write out bconsole commands +cat <${cwd}/tmp/bconcmds +@$out /dev/null +messages +@$out ${cwd}/tmp/log1.out +setdebug level=000 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 migrated) +run job=$JobName yes +run job=$JobName yes +wait +list jobs +list volumes +@#setdebug level=100 dir +@# should migrate two jobs +@#setdebug level=51 storage=DiskChanger +run job=migrate-job yes +wait +messages +@# purge volume=FileVolume001 +list jobs +list volumes +list joblog jobid=6 +wait +@# +@# Now do another backup, but level Incremental +@# +run job=$JobName level=Incremental yes +wait +messages +@sleep 1 +@################################################################ +@$out $cwd/tmp/log3.out +@# +@# This final job that runs should be Incremental and +@# not upgraded to full. +list jobs +prune jobs yes +list jobs +@################################################################ +@# now do a restore +@# +@$out ${cwd}/tmp/log2.out +list volumes +restore where=${cwd}/tmp/bacula-restores select storage=DiskChanger +unmark * +mark * +done +yes +list volumes +wait +messages +quit +END_OF_DATA + +run_bacula +check_for_zombie_jobs storage=File +stop_bacula + +check_two_logs +check_restore_diff + +$bperl -e "check_job_list('$tmp/log3.out',1,2,3,4,5,7)" +estat=$(($estat + $?)) + +end_test -- 2.39.5