-
Notifications
You must be signed in to change notification settings - Fork 256
/
testrunner-filesettext-is-updated
executable file
·68 lines (49 loc) · 1.54 KB
/
testrunner-filesettext-is-updated
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
#!/bin/bash
set -e
set -o pipefail
set -u
# Delete fileset text from database and check that it is readded
# when estimate call uses the fileset
TestName="$(basename "$(pwd)")"
export TestName
#shellcheck source=../environment.in
. ./environment
#shellcheck source=../scripts/functions
. "${rscripts}"/functions
start_test
run_log=$tmp/run.out
filesetwithtext=$tmp/fileset-with-filesettext
filesetwithouttext=$tmp/fileset-without-filesettext
JobName=backup-bareos-fd
rm -f $run_log $filesetwithtext $filesetwithouttext
cat <<END_OF_DATA >"$tmp/bconcmds"
@$out /dev/null
messages
@$out $run_log
@# first do an estimate to be sure the fileset db entry exists
estimate listing job=$JobName
@# remove filesettext from db entry
sqlquery
update fileset set filesettext='';
@$out $filesetwithouttext
@# display fileset entry (without filesettext)
sqlquery
select * from fileset;
@# call estimate to update the fileset db entry and readd the filesettext
estimate listing job=$JobName
@#verify the fileset text is added again
@$out $filesetwithtext
sqlquery
select * from fileset;
END_OF_DATA
run_bconsole
run_bconsole
# check that the fileset has not the fileset text after it was deleted
expect_grep "| 1 | SelfTest | FileSet {" \
"$filesetwithtext" \
"The expected fileset text was not found."
# check that the fileset has the fileset was added by the estimate call
expect_grep "| 1 | SelfTest | |" \
"$filesetwithouttext" \
"The expected fileset without text was not found."
end_test