This repository has been archived by the owner on Mar 19, 2021. It is now read-only.
/
rerun-test
executable file
·102 lines (78 loc) · 1.95 KB
/
rerun-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
#!/bin/sh
#
#
TestName="rerun-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
run job=$JobName yes
wait
messages
@$out ${cwd}/tmp/log2.out
rerun jobid=1 yes
wait
messages
@$out ${cwd}/tmp/log3.out
rerun hours=1 yes
wait
messages
@$out ${cwd}/tmp/log4.out
rerun days=1 yes
wait
messages
@$out ${cwd}/tmp/log5.out
rerun since_jobid=1 yes
wait
messages
quit
END_OF_DATA
run_bareos
#scripts/check_for_zombie_jobs storage=File client=client
echo "rerun check done"
stop_bareos
## check if first job failed
grep "JobId 1: Fatal error: Client .* RunScript failed." ${tmp}/log1.out 2>&1 >/dev/null
if test $? -eq 0; then
print_debug "First job failed as intended."
else
estat=1
fi
## check if rerun of first job worked and failed itself
grep "JobId 2: Fatal error: Client .* RunScript failed." ${tmp}/log2.out 2>&1 >/dev/null
if test $? -eq 0; then
print_debug "First job failed as intended."
else
estat=2
fi
## check if rerun of failed jobs in last hour worked, we expect to have selected ids 1 and 2
grep "^1,2" ${tmp}/log3.out 2>&1 >/dev/null
if test $? -eq 0; then
print_debug "rerun last hour selected jobs 1 and 2."
else
estat=3
fi
## check if rerun of failed jobs in last day worked, we expect to have selected ids 1 2 3
grep "^1,2,3" ${tmp}/log4.out 2>&1 >/dev/null
if test $? -eq 0; then
print_debug "rerun last hour selected jobs 1,2,3 OK"
else
estat=4
fi
## check if rerun of failed jobs in last day worked, we expect to have selected ids 1 2 3
grep "^1,2,3,4,5,6,7,8" ${tmp}/log5.out 2>&1 >/dev/null
if test $? -eq 0; then
print_debug "rerun last hour selected jobs 1-8 OK"
else
estat=5
fi
stop_bareos
end_test