This repository has been archived by the owner on Mar 19, 2021. It is now read-only.
/
quota-includefailed-test
executable file
·92 lines (69 loc) · 1.79 KB
/
quota-includefailed-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
#!/bin/sh
#
# Run a backup of generated data and check if the
# "Quota Include Failed Jobs" directive works
#
TestName="quota-includefailed-test"
JobName=BackupClient1
. scripts/functions
scripts/cleanup
scripts/copy-test-confs
rm -f bin/bareos-dir.conf
/bin/cp -f ${rconfigs}/${TestName}/bareos-dir.conf.quota-includefailed-test bin/bareos-dir.conf
# create test data
dd if=/dev/zero of=${cwd}/tmp/testdata bs=40000k count=1
echo "${cwd}/tmp/testdata" >${cwd}/tmp/file-list
start_test
#@$out /dev/null
cat >${cwd}/tmp/bconcmds <<END_OF_DATA
messages
label storage=File volume=TestVolume001
@$out ${cwd}/tmp/log1.out
run job=Errorjob Level=Full yes
wait
messages
@$out ${cwd}/tmp/log2.out
run job=$JobName Level=Full yes
wait
messages
END_OF_DATA
run_bareos
check_for_zombie_jobs storage=File
stop_bareos
# switch to not include failed jobs
mv bin/bareos-dir.conf bin/bareos-dir.conf.bak
sed 's/Quota Include Failed Jobs = yes/Quota Include Failed Jobs = no/'< bin/bareos-dir.conf.bak > bin/bareos-dir.conf
cat >${cwd}/tmp/bconcmds <<END_OF_DATA
messages
@$out ${cwd}/tmp/log3.out
run job=$JobName Level=Full yes
wait
messages
END_OF_DATA
#
run_bareos
check_for_zombie_jobs storage=File
stop_bareos
# check if job1 is successful
grep "^ Termination: .*Backup Error " ${tmp}/log1.out 2>&1 >/dev/null
if test $? -eq 0; then
print_debug "First Backup is Error, OK."
else
estat=1
fi
#
# check if job is no successful
grep "^ Termination: .*Backup Error " ${tmp}/log2.out 2>&1 >/dev/null
if test $? -eq 0; then
print_debug "Check for Hardquota: Backup Error is OK."
else
estat=2
fi
# check if job is successful again
grep "Termination.*Backup OK" ${tmp}/log3.out 2>&1 >/dev/null
if test $? -eq 0; then
print_debug "After switching to not include failed jobs, Backup is OK"
else
estat=3
fi
end_test