CCF/tests/raft_scenarios/check_quorum

109 строки
2.0 KiB
Plaintext

start_node,0
assert_detail,0,leadership_state,Leader
emit_signature,2
assert_detail,0,leadership_state,Leader
assert_commit_idx,0,2
trust_node,2,1
emit_signature,2
dispatch_all
periodic_all,10
dispatch_all
assert_commit_idx,0,4
trust_node,2,2
emit_signature,2
dispatch_all
periodic_all,10
dispatch_all
assert_commit_idx,0,6
trust_node,2,3
emit_signature,2
dispatch_all
periodic_all,10
dispatch_all
assert_commit_idx,0,8
dispatch_all
periodic_all,10
dispatch_all
assert_state_sync
# An initial entry is written and successfully replicated
replicate,2,helloworld
emit_signature,2
periodic_all,10
dispatch_all
periodic_all,10
dispatch_all
state_all
assert_state_sync
# Disconnect primary 0 from a minority of backups [1].
# Primary 0 should remain primary.
disconnect,0,1
# 0 sends AE and receives ACKs from [2,3]
periodic_all,10
dispatch_all
periodic_one,0,50
dispatch_all
# 0 has now not received an ACK from 1 for longer than election timeout 100
periodic_one,0,50
dispatch_all
state_all
assert_detail,0,leadership_state,Leader
assert_detail,1,leadership_state,Follower
assert_detail,2,leadership_state,Follower
assert_detail,3,leadership_state,Follower
# Now disconnect primary 0 from another backup 1.
# Majority of backups [1,2] is disconnected and primary 0 should step down.
disconnect,0,2
assert_detail,0,leadership_state,Leader
periodic_all,10
dispatch_all
periodic_one,0,50
dispatch_all
assert_detail,0,leadership_state,Leader
# 0 has now not received an ACK from [1,2] for longer than election timeout 100
periodic_one,0,50
# Node 0 has stepped down as backup (check quorum)
state_all
assert_detail,0,leadership_state,Follower
assert_detail,1,leadership_state,Follower
assert_detail,2,leadership_state,Follower
assert_detail,3,leadership_state,Follower
# Eventually, the partition is lifted and a new leader is elected.
# In this case, we check that node 0 can be re-elected.
reconnect,0,1
reconnect,0,2
dispatch_all
periodic_one,0,100
dispatch_all
assert_detail,0,leadership_state,Leader
state_all