log-level none
----
ok

add-nodes 3 voters=(1,2,3) index=10 checkquorum=true
----
ok

campaign 1
----
ok

stabilize
----
ok

log-level debug
----
ok

raft-state
----
1: StateLeader (Voter) Term:1 Lead:1 LeadEpoch:1
2: StateFollower (Voter) Term:1 Lead:1 LeadEpoch:1
3: StateFollower (Voter) Term:1 Lead:1 LeadEpoch:1

# Set the randomized election timeout to be worth 1 tick-election. This makes
# the test deterministic. We then have to tick-election twice as the leader
# heard from followers when it stabilized above; this trips the heartbeat lease
# check quorum condition. However, the leader won't step down because it still
# has StoreLiveness support.
set-randomized-election-timeout 1 timeout=3
----
ok

tick-election 1
----
ok

print-fortification-state 1
----
1 : 1
2 : 1
3 : 1

# Even if we haven't received any messages from the follower since last tick,
# we are still okay because the follower is fortifying us which means that it's
# active.
tick-election 1
----
ok

status 1
----
1: StateReplicate match=11 next=12 sentCommit=10 matchCommit=10
2: StateReplicate match=11 next=12 sentCommit=11 matchCommit=11
3: StateReplicate match=11 next=12 sentCommit=11 matchCommit=11

# Now, withdraw the StoreLiveness support for the leader's fortified epoch by
# bumping it. This also shows that we won't break our LeadSupportUntil promise
# to the leasing layer even if the heartbeat lease check quorum condition would
# otherwise have caused the leader to step down.
bump-epoch 1
----
  1 2 3
1 2 1 1
2 2 1 1
3 2 1 1

support-expired 1
----
ok

tick-election 1
----
INFO 1 leader at term 1 does not support itself in the liveness fabric
INFO 1 leader at term 1 does not support itself in the liveness fabric
DEBUG 1 does not have store liveness support from a quorum of peers
INFO 1 leader at term 1 does not support itself in the liveness fabric

tick-election 1
----
INFO 1 leader at term 1 does not support itself in the liveness fabric
INFO 1 leader at term 1 does not support itself in the liveness fabric
DEBUG 1 has not received messages from a quorum of peers in the last election timeout
DEBUG 1 does not have store liveness support from a quorum of peers
WARN 1 stepped down to follower since quorum is not active
DEBUG 1 setting election elapsed to start from 3 ticks after store liveness support expired
INFO 1 became follower at term 1
DEBUG 1 reset election elapsed to 0
