]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/prune-copy-test
bacula-web: Modified layout for main dashboard
[bacula/bacula] / regress / tests / prune-copy-test
1 #!/bin/sh
2 # Not yet working
3 #
4 # Run a simple backup of the Bacula build directory then copy it
5 #   to another device.
6 ##
7 TestName="prune-copy-test"
8 JobName=CopyJobSave
9 . scripts/functions
10
11
12 scripts/cleanup
13 scripts/copy-migration-confs
14 scripts/prepare-disk-changer
15 echo "${cwd}/build" >${cwd}/tmp/file-list
16 sed 's/migrate/copy/g' ${cwd}/bin/bacula-dir.conf > ${cwd}/tmp/1
17 sed 's/Migrate/Copy/g' ${cwd}/tmp/1 > ${cwd}/bin/bacula-dir.conf
18
19 dircfg=$conf/bacula-dir.conf
20 $bperl -e "add_attribute('$dircfg', 'AutoPrune', 'No', 'Client')"
21 $bperl -e "add_attribute('$dircfg', 'Job Retention', '1s', 'Client')"
22
23 change_jobname NightlySave $JobName
24 start_test
25
26 #
27 # Note, we first backup into Pool Default, 
28 #          then Copy 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 @$out /dev/null
35 messages
36 @$out ${cwd}/tmp/log1.out
37 label storage=File volume=FileVolume001 Pool=Default
38 label storage=DiskChanger volume=ChangerVolume001 slot=1 Pool=Full drive=0
39 label storage=DiskChanger volume=ChangerVolume002 slot=2 Pool=Full drive=0
40 @# run two jobs (both will be copied)
41 run job=$JobName yes
42 @sleep 2
43 run job=$JobName yes
44 wait
45 list jobs
46 list volumes
47 @#setdebug level=100 dir
48 @# should copy two jobs
49 @#setdebug level=51 storage=DiskChanger
50 run job=copy-job yes
51 wait
52 messages
53 @#purge volume=FileVolume001
54 list jobs 
55 list volumes
56 wait
57 messages
58 @#
59 @# Now do another backup, but level Incremental
60 @#
61 run job=$JobName level=Incremental yes
62 wait
63 messages
64 @#
65 @# This final job that runs should be Incremental and
66 @# not upgraded to full.
67 @exec "touch $cwd/build/po/fr.po"
68 run job=$JobName level=Incremental yes
69 wait
70 messages
71 @$out ${cwd}/tmp/log10.out
72 @sleep 1
73 setdebug level=1 director
74 list jobs
75 prune jobs yes
76 list jobs
77 @################################################################ 
78 @# now do a restore
79 @#
80 @$out ${cwd}/tmp/log2.out
81 list volumes 
82 restore where=${cwd}/tmp/bacula-restores select
83 unmark *
84 mark *
85 done
86 yes
87 list volumes
88 wait
89 messages
90 quit
91 END_OF_DATA
92
93 run_bacula
94 check_for_zombie_jobs storage=File
95 stop_bacula
96
97 check_two_logs
98 check_restore_diff
99
100 # Now we will verify that the pruning code is working as expected.  Each time,
101 # we run 'list jobs', 'prune', 'list jobs'. check_prune_list ensures that jobids
102 # in argument are present in the first 'list jobs', the 'prune' command deletes
103 # them (same number), and checks that the last 'list jobs' doesn't contain them
104 # anymore. See scripts/functions.pm for details.
105
106 # Copy jobs are pruned like normal jobs after the Job Retention period
107 # the admin 'c'opy job should also be pruned
108 # F F c c C C I0 I -> F I
109 $bperl -e "check_prune_list('$tmp/log10.out',1,3,4,5,6,7)"
110 estat=$(($estat + $?))
111
112 end_test