]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/reload-test
regress: tweak the message in the update_win32()
[bacula/bacula] / regress / tests / reload-test
1 #!/bin/sh
2 #
3 # test the reload and test command
4 #
5 TestName="reload-test"
6 . scripts/functions
7
8 require_linux
9 scripts/cleanup
10 scripts/copy-confs
11
12 bstat=0
13 rstat=0
14 zstat=0
15
16 detect_error()
17 {
18     $bin/bacula-dir -t $conf/bacula-dir.conf 2>&1 >> $tmp/testconf.log
19     if [ $? = 0 ]; then
20         estat=1
21         print_debug "Should detect error on bacula-dir.conf"
22     fi
23 }
24
25 do_reload()
26 {
27     cat > $tmp/bcons <<EOF
28 reload
29 messages
30 EOF
31     cat $tmp/bcons | $bin/bconsole -c $conf/bconsole.conf 2>&1 >>$tmp/reload.log
32
33     ps $pid > /dev/null
34     if [ $? != 0 ]; then
35         estat=1
36         print_debug "Bacula shouldn't die with a reload"
37     fi
38
39     ls -l /proc/$pid/fd | grep bacula-dir.conf
40     if [ $? = 0 ]; then
41         estat=1
42         print_debug "Should not have bacula-dir.conf open"
43     fi
44 }
45
46 start_test
47
48 # should be ok
49 $bin/bacula-dir -t $conf/bacula-dir.conf
50 if [ $? != 0 ]; then
51     estat=1
52     print_debug "Error on bacula-dir.conf"
53 fi
54
55 $bin/bacula-ctl-dir start >/dev/null
56 pid=`cat $working/bacula-dir.$BASEPORT.pid`
57 read a
58 sleep 2
59
60 ls -l /proc/$pid/fd | grep bacula-dir.conf
61 if [ $? = 0 ]; then
62     estat=1
63     print_debug "Should not have bacula-dir.conf open"
64 fi
65
66 # should work well
67 do_reload
68
69 # backup the configuration
70 cp $conf/bacula-dir.conf $tmp/1
71 cat >> $conf/bacula-dir.conf<<EOF
72 This is an error
73 EOF
74
75 detect_error
76 do_reload
77
78 cp $tmp/1 $conf/bacula-dir.conf
79 cat >> $conf/bacula-dir.conf<<EOF
80 Job {
81 }
82 EOF
83
84 detect_error
85 do_reload
86
87 cp $tmp/1 $conf/bacula-dir.conf
88 cat >> $conf/bacula-dir.conf<<EOF
89 Director {
90   Name = second-dir
91   DIRport = 1101                # where we listen for UA connections
92   QueryFile = "/tmp/regress/bin/query.sql"
93   WorkingDirectory = "/tmp/regress/working"
94   PidDirectory = "/tmp/regress/working"
95   Maximum Concurrent Jobs = 1
96   Password = "xxx"         # Console password
97   Messages = Daemon
98 }
99 EOF
100
101 detect_error
102 do_reload
103
104 cp $tmp/1 $conf/bacula-dir.conf
105 cat >> $conf/bacula-dir.conf<<EOF
106 Job {
107   Name = "BackupClient1"
108   JobDefs = "DefaultJob"
109   Write Bootstrap = "/tmp/regress/working/Client1.bsr"
110 }
111 Job {
112   Name = "BackupClient1"
113   JobDefs = "DefaultJob"
114   Write Bootstrap = "/tmp/regress/working/Client1.bsr"
115 }
116 EOF
117
118 detect_error
119 do_reload
120
121 $bin/bacula-ctl-dir stop >/dev/null
122
123 end_test