-
Notifications
You must be signed in to change notification settings - Fork 256
/
testrunner
executable file
·101 lines (80 loc) · 1.97 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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
#!/bin/bash
TestName="$(basename "$(pwd)")"
export TestName
JobName=backup-bareos-fd
#shellcheck source=../environment.in
. ./environment
#shellcheck source=../scripts/functions
. "${rscripts}"/functions
"${rscripts}"/cleanup
"${rscripts}"/setup
exit_with_error() {
echo "$1"
estat=1
end_test
exit 1
}
stop_bareos_daemons() {
stop_bareos
}
# Directory to backup.
# This directory will be created by setup_data().
BackupDirectory="${tmp}/data"
# Use a tgz to setup data to be backed up.
# Data will be placed at "${tmp}/data/".
setup_data "$@"
start_test
stop_bareos_daemons
cat <<END_OF_DATA >"${tmp}"/bconcmds
@$out /dev/null
messages
@$out $tmp/log1.out
setdebug level=100 storage=File
label volume=TestVolume001 storage=File pool=Full
run job=$JobName yes
status director
status client
status storage=File
wait
messages
@#
@# now do a restore
@#
@$out $tmp/log2.out
wait
restore client=bareos-fd fileset=SelfTest where=$tmp/bareos-restores select all done
yes
wait
messages
quit
END_OF_DATA
"${rscripts}"/bareos-ctl-dir start
sleep 1
echo "Waiting for the director to start"
if ! echo "status dir" | "${BAREOS_BCONSOLE_BINARY}" -c "$conf"/bconsole.conf > /dev/null 2>&1; then
exit_with_error "Director did not start"
fi
echo "Director is running"
"${rscripts}"/bareos-ctl-sd start
"${rscripts}"/bareos-ctl-fd start
echo "Check if the filedaemon is connected to the director"
i=0
until echo "status dir" | \
"${BAREOS_BCONSOLE_BINARY}" -c "$conf"/bconsole.conf | \
grep --quiet --word-regexp "${TestName}-fd"; do
echo "waiting for client to connect (#$i)... "
((i=i+1))
sleep 1
if [ $i -gt 10 ]; then
exit_with_error "Filedaemon ${TestName} could not connect to director"
fi
done
echo "Filedaemon is connected, running backup and restore"
run_bconsole "$tmp/bconcmds"
check_for_zombie_jobs storage=File
"${rscripts}"/bareos-ctl-dir stop
"${rscripts}"/bareos-ctl-sd stop
"${rscripts}"/bareos-ctl-fd stop
check_two_logs
check_restore_diff "${BackupDirectory}"
end_test