Skip to content

Commit 3d7826e

Browse files
committed
add tests
1 parent 680e8f1 commit 3d7826e

File tree

2 files changed

+85
-0
lines changed

2 files changed

+85
-0
lines changed

test/live_test.sh

+38
Original file line numberDiff line numberDiff line change
@@ -1163,6 +1163,44 @@ applicable_attr_prereq_fail() {
11631163
[ -n "`get_attr`" ]
11641164
}
11651165

1166+
## TEST: crmv1_group_start ##
1167+
1168+
add_crmv1_group() {
1169+
crmv1 group testgrp rsc1 Dummy rsc2 Dummy fake=test
1170+
}
1171+
1172+
rm_crmv1_group() {
1173+
crmv1 group delete testgrp
1174+
}
1175+
1176+
check_resources() {
1177+
export OCF_ROOT=/usr/lib/ocf
1178+
export OCF_RESOURCE_INSTANCE=rsc1
1179+
. /usr/lib/ocf/lib/heartbeat/ocf-shellfuncs
1180+
/usr/lib/ocf/resource.d/heartbeat/Dummy monitor || return 1
1181+
OCF_RESOURCE_INSTANCE=rsc2
1182+
export OCF_RESKEY_fake=test
1183+
/usr/lib/ocf/resource.d/heartbeat/Dummy monitor || return 1
1184+
return 0
1185+
}
1186+
1187+
# crmv1 start a group
1188+
setup_crmv1_group_start_ok() {
1189+
add_crmv1_group
1190+
}
1191+
test_crmv1_group_start_ok() {
1192+
wait_exp
1193+
wait_timeout
1194+
}
1195+
check_crmv1_group_start_ok() {
1196+
check_resources
1197+
}
1198+
recover_crmv1_group_start_ok() {
1199+
stop_site `get_site 1`
1200+
stop_site `get_site 2`
1201+
rm_crmv1_group
1202+
}
1203+
11661204
#
11671205
# environment modifications
11681206
#

unit-tests/030_crmv1.txt

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# vim: ft=sh et :
2+
#
3+
# Testing crmv1 groups
4+
5+
6+
ticket:
7+
name "tick1"
8+
state ST_LEADER
9+
current_term 40
10+
leader local
11+
# may keep ticket all the time
12+
term_duration 3000
13+
# but shall start renewal now
14+
term_expires time(0) + 1000
15+
req_sent_at time(0) - 10
16+
17+
18+
gdb0:
19+
call parse_extprog("test `set|grep ^BOOTH|wc -l` -ge 5", booth_conf->ticket+0)
20+
21+
outgoing0:
22+
header.cmd OP_HEARTBEAT
23+
24+
25+
testgrp:
26+
ext_verifier 'test "$BOOTH_TICKET" == "tick1"'
27+
# cause re-query of the verifier
28+
req_sent_at time(0) - 10
29+
30+
#
31+
#gdb1:
32+
# break ticket_broadcast_proposed_state § commands § bt § c § end
33+
34+
35+
outgoing1:
36+
header.cmd OP_HEARTBEAT
37+
38+
39+
# now say that we may not have it anymore.
40+
ticket2:
41+
ext_verifier 'test "$BOOTH_TICKET" == "tick2FOO"'
42+
# cause re-query of the verifier
43+
req_sent_at time(0) - 10
44+
45+
finally:
46+
state ST_LEADER
47+
leader local

0 commit comments

Comments
 (0)