]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/restart2-job-test
Make out of freespace non-fatal for removable devices -- i.e. behaves like tape
[bacula/bacula] / regress / tests / restart2-job-test
1 #!/bin/sh
2 #
3 # Copyright (C) 2000-2017 Kern Sibbald
4 # License: BSD 2-Clause; see file LICENSE-FOSS
5 #
6 # Run a backup of the build directory but force it to have
7 #   a comm error, and check that it restarts correctly.
8 #
9 TestName="restart2-job-test"
10 JobName=RestartJob
11 . scripts/functions
12
13 scripts/cleanup
14 scripts/copy-test-confs
15 setup_shstore # simulate shared storage if enabled
16 echo "${cwd}/build" >${cwd}/tmp/file-list
17
18 change_jobname NightlySave $JobName
19 $bperl -e 'add_attribute("$conf/bacula-fd.conf", "MaximumBandwidthPerJob", "100 kB/s", "FileDaemon")'
20
21 start_test
22
23 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
24 @output /dev/null
25 messages
26 @$out ${cwd}/tmp/log1.out
27 @#setdebug level=0 trace=0 hangup=469 client
28 @#setdebug level=20 dir
29 label storage=File volume=TestVolume001
30 run job=$JobName yes
31 @sleep 15
32 status client
33 status storage=File
34 END_OF_DATA
35
36 run_bacula 2>/dev/null 
37
38 # Note, the following stops and restarts the FD while it
39 #  is running to simulate a crash, so it is normal if
40 #  orphanned buffers are reported
41 #sleep 9
42 $scripts/bacula-ctl-fd stop >/dev/null 2>&1
43 sleep 5
44 $scripts/bacula-ctl-fd start 1>/dev/null 2>&1
45 sleep 5
46
47 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
48 @$out ${cwd}/tmp/log1.out
49 @sleep 15
50 messages
51 quit
52 END_OF_DATA
53
54 run_bconsole 
55
56 # Note, the following stops and restarts the FD while it
57 #  is running to simulate a crash, so it is normal if
58 #  orphanned buffers are reported
59 #sleep 9
60 $scripts/bacula-ctl-fd stop >/dev/null 2>&1
61 sleep 5
62 $scripts/bacula-ctl-fd start >/dev/null 2>&1
63 sleep 5
64
65 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
66 @$out ${cwd}/tmp/log1.out
67 @sleep 15
68 messages
69 quit
70 END_OF_DATA
71
72 run_bconsole 
73
74 #
75 # This is the last backup, so make it run in a reasonable time
76 #
77 $bperl -e 'add_attribute("$conf/bacula-fd.conf", "MaximumBandwidthPerJob", "500000 kB/s", "FileDaemon")'
78
79 #sleep 9
80 $scripts/bacula-ctl-fd stop >/dev/null 2>&1
81 sleep 5
82 $scripts/bacula-ctl-fd start
83 sleep 5
84
85 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
86 @$out ${cwd}/tmp/log1.out
87 wait
88 messages
89 sql
90 select * from JobMedia where JobId=1;
91
92 quit
93 END_OF_DATA
94
95
96 run_bconsole  
97
98 scripts/check_for_zombie_jobs storage=File
99
100 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
101 @output /dev/null
102 messages
103 @# 
104 @# now do a restore
105 @#
106 @$out ${cwd}/tmp/log2.out
107 @#setdebug level=50 storage=File
108 restore where=$tmp/bacula-restores storage=File select all done
109 yes
110 wait
111 messages
112 status dir
113 status client
114 status storage=File
115 messages
116 quit
117 END_OF_DATA
118
119 run_bconsole
120 scripts/check_for_zombie_jobs storage=File
121 stop_bacula
122
123 check_two_logs
124 check_restore_diff
125
126 grep "Sending Accurate" $tmp/log1.out >/dev/null
127 if [ $? != 0 ]; then
128     print_debug "ERROR: Second job should use Accurate"
129     estat=1
130 fi
131
132 end_test