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