]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/restart-base-job-test
baculum: Add module to check resource dependencies
[bacula/bacula] / regress / tests / restart-base-job-test
1 #!/bin/sh
2 #
3 # Copyright (C) 2000-2015 Kern Sibbald
4 # License: BSD 2-Clause; see file LICENSE-FOSS
5 #
6
7 #
8 # Run a backup of the build directory but force it to have
9 #   a comm error, and check that it restarts correctly.
10 #
11 #  NOTE!!!  This test will always fail, because currently we cannot
12 #           restart a Backup Job that has Base files specified.
13 #
14 TestName="restart-base-job-test"
15 JobName=RestartJobWithBase
16 . scripts/functions
17
18 scripts/cleanup
19 scripts/copy-test-confs
20 echo "${cwd}/build" >${cwd}/tmp/file-list
21
22 change_jobname NightlySave $JobName
23
24 $bperl -e "add_attribute('$conf/bacula-dir.conf', 'Base', '$JobName', 'Job', '$JobName')"
25 $bperl -e "add_attribute('$conf/bacula-dir.conf', 'Accurate', 'yes', 'Job', '$JobName')"
26 start_test
27
28 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
29 @output /dev/null
30 messages
31 @$out ${cwd}/tmp/log1.out
32 label storage=File volume=TestVolume001
33 run job=$JobName level=Base yes
34 wait
35 messages
36 @exec "touch $cwd/build/po/fr.po"
37 setdebug level=0 trace=0 hangup=100 client
38 setdebug level=200 trace=1 dir
39 run job=$JobName yes
40 wait
41 messages
42 sql
43 select * from JobMedia;
44
45 setdebug level=0 trace=0 dir
46 @$out ${cwd}/tmp/log3.out
47 list jobs
48 quit
49 END_OF_DATA
50
51 run_bacula  
52
53 scripts/check_for_zombie_jobs storage=File
54
55 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
56 @output /dev/null
57 messages
58 @# 
59 @# now do a restore
60 @#
61 @$out ${cwd}/tmp/log2.out
62 restore where=$tmp/bacula-restores storage=File select all done
63 yes
64 wait
65 messages
66 quit
67 END_OF_DATA
68
69 run_bconsole
70 scripts/check_for_zombie_jobs storage=File1
71 stop_bacula
72
73 check_two_logs
74 check_restore_diff
75
76 nb_B=`awk -F '|' '/RestartJob.+ B.+ B/ { gsub(/,/, "");print $7}' $tmp/log3.out`
77 nb_F=`awk -F '|' '/RestartJob.+F/ { gsub(/,/, ""); print $7}' $tmp/log3.out`
78
79 if [ $nb_F -ne $nb_B ]; then
80     print_debug "ERROR: Base and Full should have the same number of files"
81     estat=1
82 fi 
83
84 nb_B=`awk -F '|' '/RestartJob.+B.+B/ { gsub(/,/, ""); print $8}' $tmp/log3.out`
85 nb_F=`awk -F '|' '/RestartJob.+F/ { gsub(/,/, ""); print $8}' $tmp/log3.out`
86
87 if [ $nb_F -gt 1000000 ]; then
88     print_debug "ERROR: Base job should backup only one file"
89     estat=2
90 fi
91