]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/mcj-test
e92a335e551d4c2bf11e56988a7da0cb8f5e3ec1
[bacula/bacula] / regress / tests / mcj-test
1 #!/bin/sh
2 #
3 # Run a simple backup of the Bacula build directory and see
4 # if bacula is respecting the maximum concurrent job (MJC)
5 #
6 TestName="mjc-test"
7 JobName=backup
8 . scripts/functions
9
10 scripts/cleanup
11 scripts/copy-confs
12
13 #
14 # Zap out any schedule in default conf file so that
15 #  it doesn't start during our test
16 #
17 outf="$tmp/sed_tmp"
18 echo "s%  Schedule =%# Schedule =%g" >${outf}
19 cp $scripts/bacula-dir.conf $tmp/1
20 sed -f ${outf} $tmp/1 >$scripts/bacula-dir.conf
21
22 change_jobname BackupClient1 $JobName
23 start_test
24
25 cat <<END_OF_DATA >$tmp/bconcmds
26 @$out /dev/null
27 messages
28 @$out $tmp/log1.out
29 label volume=TestVolume001 storage=File1 pool=File slot=1 drive=0
30 show client
31 setbandwidth limit="100 kb/s" client
32 run job=$JobName level=full yes
33 @sleep 5
34 status dir
35 @sleep 5
36 run job=$JobName level=full comment="Should be waiting for Maximum Concurrent Job" yes
37 @sleep 5
38 status dir
39 @# The following reload command is causing a bug with the current code
40 reload
41 @sleep 2
42 run job=$JobName level=full comment="Should be waiting for Maximum Concurrent Job" yes
43 @sleep 5
44 @$out $tmp/log3.out
45 @# ##################################################################################
46 @# If everything is alright, we should find two jobs waiting for MaximumConcurrentJob
47 @# ##################################################################################
48 status dir
49 @# ##################################################################################
50 @$out $tmp/log1.out
51 setbandwidth limit="10000000 kb/s" client
52 wait
53 messages
54 @# 
55 @# now do a restore
56 @#
57 @$out $tmp/log2.out  
58 restore where=$tmp/bacula-restores select all done
59 yes
60 wait
61 messages
62 quit
63 END_OF_DATA
64
65 run_bacula
66 check_for_zombie_jobs storage=File1
67 stop_bacula
68
69 check_two_logs
70 check_restore_diff
71
72 nb=$(grep "is waiting" $tmp/log3.out | wc -l)
73 if [ $nb -ne 2 ]; then
74     print_debug "ERROR: Should find two jobs in $tmp/log3.out waiting for Maximum Concurrent Jobs, got $nb"
75     estat=1
76 fi
77
78 end_test