/
testrunner
executable file
·100 lines (79 loc) · 2.2 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/sh
#
# Run a simple backup on a mysql database
# then convert to postgresql and restore it.
#
TestName="$(basename "$(pwd)")"
export TestName
JobName=backup-bareos-fd
. ./environment
. ${scripts}/functions
. ./environment-postgresql
${scripts}/cleanup
${scripts}/setup
. ./environment-mysql
${scripts}/cleanup
${scripts}/setup
# 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
echo "$conf" > "$tmp/file-list-python-plugin"
start_test
#enable only mysql (disable postgresql)
mv "${conf}"/bareos-dir.d/catalog/postgresql.conf "${conf}"/bareos-dir.d/catalog/postgresql.conf.disabled
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 catalog=mysql
run job=$JobName yes
status director
status client=bareos-fd
status storage=File
wait
messages
@$out $tmp/files.mysql
messages
list files jobid=1
END_OF_DATA
run_bareos
stop_bareos
#enable mysql and postgresql
mv "${conf}"/bareos-dir.d/catalog/postgresql.conf.disabled "${conf}"/bareos-dir.d/catalog/postgresql.conf
#do the database copy
"${sbin}"/bareos-dbcopy -d -c ${current_test_directory}/etc/bareos mysql postgresql
#enable only postgresql (disable mysql)
mv "${conf}"/bareos-dir.d/catalog/mysql.conf "${conf}"/bareos-dir.d/catalog/mysql.conf.disabled
cat <<END_OF_DATA >$tmp/bconcmds
@#
@# now do a restore on the postgresql database
@#
@$out $tmp/log2.out
wait
restore client=bareos-fd fileset=SelfTest where=$tmp/bareos-restores select all done
yes
wait
messages
@$out $tmp/files.postgresql
messages
list files jobid=1
END_OF_DATA
run_bareos
check_for_zombie_jobs storage=File client=bareos-fd
stop_bareos
check_two_logs
check_restore_diff ${BackupDirectory}
sed -i '/Using Catalog.*/d' "${tmp}"/files.postgresql
sed -i '/Using Catalog.*/d' "${tmp}"/files.mysql
sort "${tmp}"/files.mysql -o "${tmp}"/files.mysql
sort "${tmp}"/files.postgresql -o "${tmp}"/files.postgresql
if ! diff "${tmp}"/files.mysql "${tmp}"/files.postgresql;
then
estat=1
echo "differences in \"list files jobid=1\" output!"
fi
end_test