]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/aligned-bug-8013-test
Big backport from Enterprise
[bacula/bacula] / regress / tests / aligned-bug-8013-test
1 #!/bin/sh
2 #
3 # Copyright (C) 2000-2017 Kern Sibbald
4 # License: BSD 2-Clause; see file LICENSE-FOSS
5 #
6 # Test of aligned volumes. It does not require running on
7 #   a ZFS filesystem, but attempts to reproduce a condition
8 #   where the volume and catalog sizes do not agree, and
9 #   when Bacula fixes it another number of Files error occurs
10 #   causing the second job to fail.
11 #
12 TestName="aligned-bug-8013-test"
13 JobName=NightlySave
14 . scripts/functions
15
16 if test x$FORCE_CLOUD = xyes ; then
17    echo "\n=== Test $TestName skipped not compatible with Cloud  ==="
18    exit 0
19 fi
20
21 scripts/cleanup
22 scripts/copy-test-confs
23 cp scripts/aligned-bacula-sd.conf bin/bacula-sd.conf
24
25 # install the aligned volume plugin
26 #make -C build/src/plugins/sd install-aligned-plugin >/dev/null
27
28 echo "${cwd}/build" >${cwd}/tmp/file-list
29
30 start_test
31
32 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
33 @output /dev/null
34 messages
35 @$out ${cwd}/tmp/log1.out
36 label storage=File volume=Vol1
37 label storage=File volume=Vol2
38 label storage=File volume=Vol3
39 label storage=File volume=Vol4
40 label storage=File volume=Vol5
41 update volume=Vol1 maxvolbytes=60M
42 update volume=Vol2 maxvolbytes=60M
43 update volume=Vol3 maxvolbytes=60M
44 update volume=Vol4 maxvolbytes=60M
45 @# Leave Vol5 with no size limit
46 END_OF_DATA
47
48 # do label
49 run_bacula
50
51 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
52 @output /dev/null
53 messages
54 @$out ${cwd}/tmp/log1.out
55 setdebug level=0 hangup=100 client
56 run job=$JobName level=Full yes
57 setdebug level=0 hangup=0 client
58 wait
59 list volumes
60 update volume=Vol1 volstatus="Append"
61 sql
62 update Media SET VolFiles=2,VolBytes=100,VolABytes=100 WHERE VolumeName='Vol1';
63
64 setdebug level=15 storage=File
65 list volumes
66 messages
67 END_OF_DATA
68
69 for i in 1 2 3 4 5 ; do
70   if test "$debug" -eq 1 ; then
71      echo "Running job $i"
72   fi
73   run_bconsole
74   if test "$debug" -eq 1 ; then
75      ls -l tmp/Vol*
76      du -h tmp/Vol1.add
77   fi
78 done
79
80 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
81 @output /dev/null
82 messages
83 @$out ${cwd}/tmp/log1.out
84 setdebug level=0 hangup=0 client
85 run job=$JobName level=Full yes
86 wait
87 list volumes
88 messages
89 END_OF_DATA
90
91 for i in 6 7 8 9 10; do
92   if test "$debug" -eq 1 ; then
93      echo "Running job $i"
94   fi
95   run_bconsole
96   if test "$debug" -eq 1 ; then
97      ls -l tmp/Vol*
98      du -h tmp/Vol1.add
99   fi
100 done
101
102 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
103 @# 
104 @# now do a restore
105 @#
106 @$out ${cwd}/tmp/log2.out
107 @# setdebug level=0 fd
108 restore where=${cwd}/tmp/bacula-restores storage=File
109 5
110 mark *
111 done
112 yes
113 wait
114 messages
115 quit
116 END_OF_DATA
117
118 run_bconsole
119
120 if test "$debug" -eq 1 ; then
121    ls -l tmp/Vol*
122    du -h tmp/Vol1.add
123 fi
124
125 sleep 2
126 check_for_zombie_jobs storage=File 
127 stop_bacula
128
129 check_two_logs
130 check_restore_diff
131 end_test