From 49fe7fa03e1cb9abf822ab4e55a71d45f4ab12fd Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Sat, 19 Aug 2006 12:07:27 +0000 Subject: [PATCH] Update + add migration tests git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@3305 91ce42f0-d328-0410-95d8-f526ca767f89 --- regress/all-non-root-tests | 1 + regress/scripts/bacula-dir-migration.conf.in | 35 ++++++++- regress/tests/migration-job-test | 2 +- ...igration-test => migration-occupancy-test} | 23 ++++-- regress/tests/migration-time-test | 78 +++++++++++++++++++ 5 files changed, 130 insertions(+), 9 deletions(-) rename regress/tests/{migration-test => migration-occupancy-test} (72%) create mode 100755 regress/tests/migration-time-test diff --git a/regress/all-non-root-tests b/regress/all-non-root-tests index 8eff3fde0e..e782ca2422 100755 --- a/regress/all-non-root-tests +++ b/regress/all-non-root-tests @@ -32,6 +32,7 @@ tests/weird-files2-test tests/weird-files-test tests/migration-job-test tests/migration-volume-test +tests/migration-time-test # # The following are Virtual Disk Autochanger tests tests/two-pool-test diff --git a/regress/scripts/bacula-dir-migration.conf.in b/regress/scripts/bacula-dir-migration.conf.in index f14cf8a226..cd5309e078 100644 --- a/regress/scripts/bacula-dir-migration.conf.in +++ b/regress/scripts/bacula-dir-migration.conf.in @@ -41,7 +41,7 @@ Job { } Job { - Name = "migrate" + Name = "migrate-job" Type = Migrate Level = Full Client=@hostname@-fd @@ -70,6 +70,36 @@ Job { Selection Pattern = "File*" } +Job { + Name = "migrate-occupancy" + Type = Migrate + Level = Full + Client=@hostname@-fd + FileSet="Full Set" + Messages = Standard + Storage = DiskChanger + Write Bootstrap = "@working_dir@/migratejob.bsr" + Pool = Default + Maximum Concurrent Jobs = 4 + Selection Type = PoolOccupancy +} + +Job { + Name = "migrate-time" + Type = Migrate + Level = Full + Client=@hostname@-fd + FileSet="Full Set" + Messages = Standard + Storage = DiskChanger + Write Bootstrap = "@working_dir@/migratejob.bsr" + Pool = Default + Maximum Concurrent Jobs = 4 + Selection Type = PoolTime +} + + + # Standard Restore template, to be changed by Console program Job { @@ -184,6 +214,9 @@ Pool { Volume Retention = 365d # one year NextPool = Full Storage = File + Migration High Bytes = 40M + Migration Low Bytes = 20M + Migration Time = 60 } Pool { diff --git a/regress/tests/migration-job-test b/regress/tests/migration-job-test index fccf7af646..d243c99712 100755 --- a/regress/tests/migration-job-test +++ b/regress/tests/migration-job-test @@ -41,7 +41,7 @@ run job=$JobName yes wait list volumes @# should migrate two jobs -run job=migrate yes +run job=migrate-job yes list volumes wait messages diff --git a/regress/tests/migration-test b/regress/tests/migration-occupancy-test similarity index 72% rename from regress/tests/migration-test rename to regress/tests/migration-occupancy-test index 2846a70fa6..e5c9e35f78 100755 --- a/regress/tests/migration-test +++ b/regress/tests/migration-occupancy-test @@ -5,10 +5,10 @@ # # This script uses the virtual disk autochanger # -TestName="migration-test" -JobName=MigrationSave +TestName="migration-occupancy-test" +JobName=MigrationJobSave . scripts/functions -set_debug 1 +set_debug 0 . config.out @@ -21,23 +21,32 @@ change_jobname NightlySave $JobName start_test # -# Note, we first backup into Pool Default, then Migrate into -# Pool Full. Pool Default uses Storage=File +# 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 <tmp/bconcmds -@$out /dev/null +@output messages @$out tmp/log1.out 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 list volumes +@# run two jobs (both will be migrated) +run job=$JobName yes run job=$JobName yes +wait +update volume=FileVolume001 VolStatus=Used list volumes -run job=migrate +@# should migrate two jobs +run job=migrate-occupancy yes list volumes +wait +messages +wait @# @# now do a restore @# diff --git a/regress/tests/migration-time-test b/regress/tests/migration-time-test new file mode 100755 index 0000000000..0b574264c1 --- /dev/null +++ b/regress/tests/migration-time-test @@ -0,0 +1,78 @@ +#!/bin/sh +# +# Run a simple backup of the Bacula build directory then migrate it +# to another device. +# +# This script uses the virtual disk autochanger +# +TestName="migration-time-test" +JobName=MigrationJobSave +. scripts/functions +set_debug 0 + +. config.out + +scripts/cleanup +scripts/copy-migration-confs +scripts/prepare-two-disks +echo "${cwd}/build" >/tmp/file-list + +change_jobname NightlySave $JobName +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 <tmp/bconcmds +@output +messages +@$out tmp/log1.out +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 +list volumes +@# run three jobs +run job=$JobName level=Full yes +run job=$JobName level=Full yes +run job=$JobName level=Full yes +wait +update volume=FileVolume001 VolStatus=Used +sql +update Job SET RealEndTime='2004-01-01 12:01:01' WHERE JobId IN (2,3); + +llist jobid=2,3 +list jobs +list volumes +@# should migrate only jobid=2 and 3 +run job=migrate-time yes +wait +messages +wait +list jobs +list volumes +@# +@# now do a restore +@# +@$out tmp/log2.out +restore where=${cwd}/tmp/bacula-restores select storage=DiskChanger +unmark * +mark * +done +yes +wait +messages +@output +quit +END_OF_DATA + +run_bacula +check_for_zombie_jobs storage=File +stop_bacula + +check_two_logs +check_restore_diff +end_test -- 2.39.5