16
if [ x$cib = x0 ]; then
18
22
if [ $rc -ne $target ]; then
19
23
num_errors=`expr $num_errors + 1`
20
24
printf "* Failed (rc=%.3d): %-14s - %s\n" $rc $app "$msg"
21
if [ ! -z $exit_code ]; then
25
printf "* Failed (rc=%.3d): %-14s - %s\n" $rc $app "$msg" 1>&2
27
29
printf "* Passed: %-14s - %s\n" $app "$msg"
30
printf "* Passed: %-14s - %s\n" $app "$msg" 1>&2
28
32
num_passed=`expr $num_passed + 1`
61
65
function test_tools() {
62
66
export CIB_shadow_dir=$test_home
63
$VALGRIND_CMD crm_shadow --batch --force --create-empty $shadow
67
$VALGRIND_CMD crm_shadow --batch --force --create-empty $shadow 2>&1
64
68
export CIB_shadow=$shadow
65
$VALGRIND_CMD cibadmin -Q
69
$VALGRIND_CMD cibadmin -Q 2>&1
67
$VALGRIND_CMD cibadmin -E
68
assert $? 1 cibadmin "Require --force for CIB erasure"
71
$VALGRIND_CMD cibadmin -E 2>&1
72
assert $? 22 cibadmin "Require --force for CIB erasure"
70
74
$VALGRIND_CMD cibadmin -E --force
71
75
assert $? 0 cibadmin "Allow CIB erasure with --force"
85
89
$VALGRIND_CMD cibadmin -D -o crm_config --xml-text '<nvpair id="cib-bootstrap-options-cluster-delay"/>'
86
90
assert $? 0 cibadmin "Delete nvpair"
88
$VALGRIND_CMD cibadmin -C -o crm_config --xml-file /tmp/$$.opt.xml
89
assert $? 21 cibadmin "Create operaton should fail with: -21, The object already exists"
92
$VALGRIND_CMD cibadmin -C -o crm_config --xml-file /tmp/$$.opt.xml 2>&1
93
assert $? 76 cibadmin "Create operaton should fail with: -76, The object already exists"
91
95
$VALGRIND_CMD cibadmin -M -o crm_config --xml-file /tmp/$$.opt.xml
92
96
assert $? 0 cibadmin "Modify cluster options section"
98
102
assert $? 0 crm_attribute "Set duplicate cluster option"
100
104
$VALGRIND_CMD crm_attribute -n cluster-delay -v 30s
101
assert $? 216 crm_attribute "Setting multiply defined cluster option should fail with -216, Could not set cluster option"
105
assert $? 234 crm_attribute "Setting multiply defined cluster option should fail with -216, Could not set cluster option"
103
107
$VALGRIND_CMD crm_attribute -n cluster-delay -v 30s -s duplicate
104
108
assert $? 0 crm_attribute "Set cluster option with -s"
122
126
assert $? 0 cibadmin "Digest calculation"
124
128
# This update will fail because it has version numbers
125
$VALGRIND_CMD cibadmin -R --xml-file /tmp/$$.existing.xml
126
assert $? 45 cibadmin "Replace operation should fail with: -45, Update was older than existing configuration"
129
$VALGRIND_CMD cibadmin -R --xml-file /tmp/$$.existing.xml 2>&1
130
assert $? 237 cibadmin "Replace operation should fail with: -45, Update was older than existing configuration"
128
132
crm_standby -N clusterNode-UNAME -G
129
133
assert $? 0 crm_standby "Default standby value"
131
135
crm_standby -N clusterNode-UNAME -v true
132
136
assert $? 0 crm_standby "Set standby status"
134
crm_standby -N clusterNode-UNAME -G
138
crm_standby -N clusterNode-UNAME -G
135
139
assert $? 0 crm_standby "Query standby value"
137
crm_standby -N clusterNode-UNAME -D
141
crm_standby -N clusterNode-UNAME -D 2>&1
138
142
assert $? 0 crm_standby "Delete standby value"
140
144
$VALGRIND_CMD cibadmin -C -o resources --xml-text '<primitive id="dummy" class="ocf" provider="pacemaker" type="Dummy"/>'
155
159
$VALGRIND_CMD crm_resource -L
156
160
assert $? 0 crm_resource "List the configured resources"
158
crm_failcount -r dummy -v 10 -N clusterNode-UNAME
162
crm_failcount -r dummy -v 10 -N clusterNode-UNAME 2>&1
159
163
assert $? 0 crm_resource "Set a resource's fail-count"
161
$VALGRIND_CMD crm_resource -r dummy -M
162
assert $? 244 crm_resource "Require a destination when migrating a resource that is stopped"
165
$VALGRIND_CMD crm_resource -r dummy -M 2>&1
166
assert $? 234 crm_resource "Require a destination when migrating a resource that is stopped"
164
$VALGRIND_CMD crm_resource -r dummy -M -N i.dont.exist
165
assert $? 234 crm_resource "Don't support migration to non-existant locations"
168
$VALGRIND_CMD crm_resource -r dummy -M -N i.dont.exist 2>&1
169
assert $? 250 crm_resource "Don't support migration to non-existant locations"
167
171
$VALGRIND_CMD crm_resource -r dummy -M -N clusterNode-UNAME
168
172
assert $? 0 crm_resource "Migrate a resource"
195
199
assert $? 0 crm_ticket "Delete ticket standby state"
198
test_tools 2>&1 | sed s/cib-last-written.*\>/\>/ > $test_home/regression.out
202
function test_date() {
203
# $VALGRIND_CMD cibadmin -Q
204
for y in 06 07 08 09 10 11 12 13 14 15 16 17 18; do
205
$VALGRIND_CMD iso8601 -d "20$y-W01-7 00Z"
206
$VALGRIND_CMD iso8601 -d "20$y-W01-7 00Z" -W -E "20$y-W01-7 00:00:00Z"
207
assert $? 0 iso8601 "20$y-W01-7" 0
208
$VALGRIND_CMD iso8601 -d "20$y-W01-1 00Z"
209
$VALGRIND_CMD iso8601 -d "20$y-W01-1 00Z" -W -E "20$y-W01-1 00:00:00Z"
210
assert $? 0 iso8601 "20$y-W01-1" 0
213
$VALGRIND_CMD iso8601 -d "2009-W53-7 00:00:00Z" -W -E "2009-W53-7 00:00:00Z"
214
assert $? 0 iso8601 "2009-W53-07" 0
216
$VALGRIND_CMD iso8601 -d "2009-01-31 00:00:00Z" -D "P1M" -E "2009-02-28 00:00:00Z"
217
assert $? 0 iso8601 "2009-01-31 + 1 Month" 0
219
$VALGRIND_CMD iso8601 -d "2009-01-31 00:00:00Z" -D "P2M" -E "2009-03-31 00:00:00Z"
220
assert $? 0 iso8601 "2009-01-31 + 2 Months" 0
222
$VALGRIND_CMD iso8601 -d "2009-01-31 00:00:00Z" -D "P3M" -E "2009-04-30 00:00:00Z"
223
assert $? 0 iso8601 "2009-01-31 + 3 Months" 0
225
$VALGRIND_CMD iso8601 -d "2009-03-31 00:00:00Z" -D "P-1M" -E "2009-02-28 00:00:00Z"
226
assert $? 0 iso8601 "2009-03-31 - 1 Month" 0
230
test_date > $test_home/regression.out
232
test_tools >> $test_home/regression.out
233
sed -i.sed 's/cib-last-written.*>/>/' $test_home/regression.out
201
235
if [ $do_save = 1 ]; then
202
236
cp $test_home/regression.out $test_home/regression.exp
205
239
grep -e "^*" $test_home/regression.out
241
if [ $num_errors != 0 ]; then
242
echo $num_errors tests failed
243
diff -u $test_home/regression.exp $test_home/regression.out
206
247
diff -u $test_home/regression.exp $test_home/regression.out
209
if [ $rc != 0 ]; then
213
elif [ $diff_rc != 0 ]; then
214
echo Tests passed but diff failed
249
echo $num_passed tests passed but diff failed
253
echo $num_passed tests passed