-
Notifications
You must be signed in to change notification settings - Fork 256
/
testrunner
executable file
·83 lines (62 loc) · 1.54 KB
/
testrunner
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#!/bin/sh
#
#set -x
#trap read debug
TestName="$(basename "$(pwd)")"
export TestName
export estat
# shellcheck disable=SC1091
. ./environment
. ${scripts}/functions
bconsole_command_file="$tmp/bconsole_reload_command"
console_logfile="$tmp/console.log"
director_debug_level=""
#director_debug_level="-d 200"
exit_with_error() {
echo "$1"
estat=1
end_test
exit 1
}
stop_director() {
"${scripts}/bareos-ctl-dir" stop
}
start_director() {
"${scripts}/bareos-ctl-dir" start "$director_debug_level"
director_pid=$(pidof ${BAREOS_DIRECTOR_BINARY})
if [ -z "$director_pid" ]; then
exit_with_error "Bareos director could not be started"
fi
}
create_console_command_file() {
if [ ! -f "$bconsole_command_file" ]; then
cat > "$bconsole_command_file" <<EOF
@$out "$console_logfile"
reload
messages
EOF
fi
}
test_reload_will_not_crash_director() {
create_console_command_file
"$bin"/bconsole -c "$conf"/bconsole.conf < "$bconsole_command_file" 2>&1 >> /dev/null
if [ $? != 0 ] ; then
exit_with_error "BConsole finished with errors"
fi
if ! ps $director_pid > /dev/null; then
exit_with_error "Bareos director should not stop after reload"
fi
}
############################################
start_test
############################################
stop_director #be sure no director is started
${scripts}/cleanup
${scripts}/setup
start_director
#reload unmodified config
test_reload_will_not_crash_director
stop_director
############################################
end_test
############################################