]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/migration-time-test
Fix status alignment output reported by Wanderlei Huttel
[bacula/bacula] / regress / tests / migration-time-test
1 #!/bin/sh
2 #
3 # Copyright (C) 2000-2015 Kern Sibbald
4 # License: BSD 2-Clause; see file LICENSE-FOSS
5 #
6
7 #
8 # Run a simple backup of the Bacula build directory then migrate it
9 #   to another device.
10 #
11 # This script uses the virtual disk autochanger
12 #
13 TestName="migration-time-test"
14 JobName=MigrationJobSave
15 . scripts/functions
16
17
18 scripts/cleanup
19 scripts/copy-migration-confs
20 scripts/prepare-disk-changer
21 echo "${cwd}/build" >${cwd}/tmp/file-list
22
23 change_jobname NightlySave $JobName
24 start_test
25
26 #
27 # Note, we first backup into Pool Default, 
28 #          then Migrate into Pool Full. 
29 #              Pool Default uses Storage=File
30 #              Pool Full    uses Storage=DiskChanger
31
32 # Write out bconsole commands
33 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
34 @output /dev/null
35 messages
36 @$out ${cwd}/tmp/log1.out
37 label storage=File volume=FileVolume001 Pool=Default
38 label storage=File volume=FileVolume002 Pool=Special
39 label storage=DiskChanger volume=ChangerVolume001 slot=1 Pool=Full drive=0
40 label storage=DiskChanger volume=ChangerVolume002 slot=2 Pool=Full drive=0
41 list volumes
42 @# run three jobs
43 run job=$JobName pool=Special level=Full yes
44 run job=$JobName level=Full yes
45 run job=$JobName level=Full yes
46 wait
47 update volume=FileVolume001 VolStatus=Used
48 update volume=FileVolume002 VolStatus=Used
49 @sleep 3
50 llist jobid=2,3
51 list jobs
52 list volumes
53 @#setdebug level=20 dir
54 @# should migrate only jobid=2 and 3
55 run job=migrate-time yes
56 wait
57 messages
58 wait
59 list jobs
60 list volumes
61 @# 
62 @# now do a restore
63 @#
64 @$out ${cwd}/tmp/log2.out
65 restore where=${cwd}/tmp/bacula-restores select storage=DiskChanger
66 unmark *
67 mark *
68 done
69 yes
70 wait
71 messages
72 quit
73 END_OF_DATA
74
75 run_bacula
76 check_for_zombie_jobs storage=File
77 stop_bacula
78
79 for i in 1 2 3; do
80     get_mig_info $i ${cwd}/tmp/log1.out
81
82     if [ "$i" -eq 1 -a -n "$RET" ]; then
83         bstat=2
84         print_debug "The first job should not have been copied"
85
86     elif [ "$i" -ne 1 -a -z "$RET" ]; then
87         bstat=2
88         print_debug "Other job should have been copied"
89     fi
90 done
91
92 check_two_logs
93 check_restore_diff
94 end_test