3 # Copyright (C) 2000-2015 Kern Sibbald
4 # License: BSD 2-Clause; see file LICENSE-FOSS
8 # Run a simple backup of the Bacula build directory but
9 # create three volumes and do six backups causing the
10 # volumes to be recycled, and cycling through the volumes
11 # twice. Tests maxvoljobs and volretention.
13 # Note, this test is a bit tricky, in that if you get too
14 # much data in the regress/build directory, the test will
15 # fail because it will run out of enough volumes to backup
18 TestName="recycle-test"
23 scripts/copy-test-confs
24 echo "${cwd}/build" >${cwd}/tmp/file-list
26 change_jobname NightlySave $JobName
29 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
32 @$out ${cwd}/tmp/log1.out
33 setdebug level=15 storage=File1
34 label storage=File1 volume=TestVolume001
35 label storage=File1 volume=TestVolume002
36 label storage=File1 volume=TestVolume003
37 label storage=File1 volume=TestVolume004
38 @# Note, this is going to fail if the pruning gets
39 @# to tight because the saved volume is too large.
40 @# In that case, either add another volume, or
41 @# increase the volume capacity a bit.
42 update Volume=TestVolume001 volretention=5s
43 update Volume=TestVolume001 maxvolbytes=250000000
44 update Volume=TestVolume002 volretention=5s
45 update Volume=TestVolume002 maxvolbytes=250000000
46 update Volume=TestVolume003 volretention=5s
47 update Volume=TestVolume003 maxvolbytes=250000000
48 update Volume=TestVolume004 volretention=5s
49 update Volume=TestVolume004 maxvolbytes=250000000
51 select mediaid,volumename,volstatus,volbytes,maxvolbytes,voljobs,volretention from Media;
52 select * from JobMedia;
53 select VolumeName,FirstWritten,LastWritten,VolBytes from Media;
55 @#setdebug level=110 storage=File1
57 run job=$JobName storage=File1 level=full yes
58 run job=$JobName storage=File1 level=full yes
59 run job=$JobName storage=File1 level=full yes
61 select * from JobMedia;
62 select VolumeName,FirstWritten,LastWritten,VolStatus,VolBytes from Media;
67 select mediaid,volumename,volstatus,volbytes,maxvolbytes,voljobs,volretention from Media;
68 select * from JobMedia;
69 select VolumeName,FirstWritten,LastWritten,VolStatus,VolBlocks,VolBytes from Media;
72 run job=$JobName storage=File1 level=full yes
73 run job=$JobName storage=File1 level=full yes
74 run job=$JobName storage=File1 level=full yes
76 select * from JobMedia;
77 select VolumeName,FirstWritten,LastWritten,VolStatus,VolBlocks,VolBytes from Media;
82 select mediaid,volumename,volstatus,volbytes,maxvolbytes,voljobs,volretention from Media;
83 select * from JobMedia;
84 select VolumeName,FirstWritten,LastWritten,VolStatus,VolBlocks,VolBytes from Media;
87 run job=$JobName storage=File1 level=full yes
88 run job=$JobName storage=File1 level=full yes
89 run job=$JobName storage=File1 level=full yes
93 select mediaid,volumename,volstatus,volbytes,maxvolbytes,voljobs,volretention from Media;
94 select * from JobMedia;
95 select VolumeName,FirstWritten,LastWritten,VolStatus,VolBlocks,VolBytes from Media;
98 run job=$JobName storage=File1 level=full yes
99 run job=$JobName storage=File1 level=full yes
100 run job=$JobName storage=File1 level=full yes
104 select mediaid,volumename,volstatus,volbytes,maxvolbytes,voljobs,volretention from Media;
105 select * from JobMedia;
106 select VolumeName,FirstWritten,LastWritten,VolStatus,VolBlocks,VolBytes from Media;
109 run job=$JobName storage=File1 level=full yes
110 run job=$JobName storage=File1 level=full yes
111 run job=$JobName storage=File1 level=full yes
115 select mediaid,volumename,volstatus,volbytes,maxvolbytes,voljobs,volretention from Media;
116 select * from JobMedia;
117 select VolumeName,FirstWritten,LastWritten,VolStatus,VolBlocks,VolBytes from Media;
125 @$out ${cwd}/tmp/log2.out
126 restore where=${cwd}/tmp/bacula-restores select storage=File1
137 check_for_zombie_jobs storage=File1