This repository has been archived by the owner on Mar 19, 2021. It is now read-only.
/
subscription-test
executable file
·105 lines (82 loc) · 2.12 KB
/
subscription-test
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
101
102
103
104
105
#!/bin/sh
#
# Run a simple backup of the Bareos build directory using the compressed option
# then backup four times, each with incremental then finally restore.
# It should require at least 4 different bsrs.
#
TestName="subscription-test"
JobName=BackupClient1
. scripts/functions
scripts/cleanup
scripts/copy-test-confs
/bin/cp -f ${rconfigs}/${TestName}/bareos-dir.conf.${TestName} bin/bareos-dir.conf
echo "${cwd}/build/src/tests" >${cwd}/tmp/file-list
change_jobname $JobName
start_test
cat <<END_OF_DATA >${cwd}/tmp/bconcmds
@$out ${cwd}/tmp/log1.out
messages
label storage=File volume=TestVolume001
status subscriptions
run job=$JobName yes
wait
messages
quit
END_OF_DATA
run_bareos
scripts/check_for_zombie_jobs storage=file client=client
echo "Backup 1 done"
stop_bareos
# check if warning after backup was issued
grep "JobId.*Warning: Subscriptions exceeded:" ${tmp}/log1.out 2>&1 >/dev/null
if test $? -eq 0; then
print_debug "Check for subscription: Warning after Backup is issued."
else
estat=1
fi
#
# check status subscriptions show a warning
grep "^Warning! No available subscriptions.*" ${tmp}/log1.out 2>&1 >/dev/null
if test $? -eq 0; then
print_debug "Check for subscription: interactive check works"
else
estat=2
fi
#
# update subscriptions to 5
sed -i"" 's#Subscriptions = 1#Subscriptions = 5#g' bin/bareos-dir.conf
touch ${cwd}/build/src/tests/*
#
# run second backup
#
cat <<END_OF_DATA >${cwd}/tmp/bconcmds
@$out ${cwd}/tmp/log2.out
messages
status subscriptions
run job=$JobName yes
wait
messages
quit
END_OF_DATA
run_bareos
scripts/check_for_zombie_jobs storage=file
echo "Backup 2 done"
# check if warning after backup was issued
grep "JobId.*Warning: Subscriptions exceeded:" ${tmp}/log2.out 2>&1 >/dev/null
if test $? -ne 0; then
print_debug "Check for subscription: Warning after Backup is not issued. Correct."
else
estat=3
fi
#
#
# check "status subscriptions" show a warning
grep "^Ok: available subscriptions.*" ${tmp}/log2.out 2>&1 >/dev/null
if test $? -eq 0; then
print_debug "Check for subscription: interactive check still gives Ok!"
else
estat=4
fi
#
stop_bareos
end_test