]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/restart2-base-job-test
Big backport from Enterprise
[bacula/bacula] / regress / tests / restart2-base-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 #
10 TestName="restart-base-job-test"
11 JobName=RestartJobWithBase
12 . scripts/functions
13
14 scripts/cleanup
15 scripts/copy-test-confs
16
17 setup_shstore # simulate shared storage if enabled
18
19 echo "${cwd}/build" >${cwd}/tmp/file-list
20
21 change_jobname NightlySave $JobName
22
23 $bperl -e "add_attribute('$conf/bacula-dir.conf', 'Base', '$JobName', 'Job', '$JobName')"
24 $bperl -e "add_attribute('$conf/bacula-dir.conf', 'Accurate', 'yes', 'Job', '$JobName')"
25 start_test
26
27 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
28 @output /dev/null
29 messages
30 @$out ${cwd}/tmp/log1.out
31 label storage=File volume=TestVolume001 slot=1 drive=0
32 setdebug level=200 storage=File
33 setdebug level=0 trace=0 hangup=43 client
34 run job=$JobName level=Base yes
35 wait
36 messages
37 @exec "touch $cwd/build/po/fr.po"
38 setdebug level=200 trace=1 dir
39 setdebug level=0 trace=0 hangup=0 client
40 run job=$JobName yes
41 wait
42 messages
43 sql
44 select * from JobMedia;
45
46 setdebug level=0 trace=0 dir
47 @$out ${cwd}/tmp/log3.out
48 list jobs
49 quit
50 END_OF_DATA
51
52 run_bacula  
53
54 scripts/check_for_zombie_jobs storage=File
55
56 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
57 @output /dev/null
58 messages
59 @# 
60 @# now do a restore
61 @#
62 @$out ${cwd}/tmp/log2.out
63 restore where=$tmp/bacula-restores storage=File select all done
64 yes
65 wait
66 messages
67 quit
68 END_OF_DATA
69
70 run_bconsole
71 scripts/check_for_zombie_jobs storage=File
72 stop_bacula
73
74 check_two_logs
75 check_restore_diff
76
77 #nb_B=`awk -F '|' '/RestartJob.+ B.+ B/ { gsub(/,/, "");print $7}' $tmp/log3.out`
78 #nb_F=`awk -F '|' '/RestartJob.+F/ { gsub(/,/, ""); print $7}' $tmp/log3.out`
79
80 #if [ $nb_F -ne $nb_B ]; then
81 #    print_debug "ERROR: Base and Full should have the same number of files"
82 #    estat=1
83 #fi 
84
85 #nb_B=`awk -F '|' '/RestartJob.+B.+B/ { gsub(/,/, ""); print $8}' $tmp/log3.out`
86 #nb_F=`awk -F '|' '/RestartJob.+F/ { gsub(/,/, ""); print $8}' $tmp/log3.out`
87
88 #if [ $nb_F -gt 1000000 ]; then
89 #    print_debug "ERROR: Base job should backup only one file"
90 #    estat=2
91 #fi
92
93 end_test