@@ -309,7 +309,10 @@ class RaftActorCandidateSpec extends TestKit(ActorSystem()) with RaftActorSpecBa
309309 candidate ! createAppendEntries(shardId, term2, anotherMemberIndex)
310310 expectMsg(AppendEntriesSucceeded (term2, LogEntryIndex (0 ), candidateMemberIndex))
311311
312- getState(candidate).stateName should be(Follower )
312+ val state = getState(candidate)
313+ state.stateName should be(Follower )
314+ state.stateData.currentTerm should be(term2)
315+ state.stateData.leaderMember should contain(anotherMemberIndex)
313316 }
314317
315318 " AppendEntries が同じ Term を持っているときは(先に別のリーダーが当選したということなので)Follower に降格" in {
@@ -324,7 +327,9 @@ class RaftActorCandidateSpec extends TestKit(ActorSystem()) with RaftActorSpecBa
324327 candidate ! createAppendEntries(shardId, term, anotherMemberIndex)
325328 expectMsg(AppendEntriesSucceeded (term, LogEntryIndex (0 ), candidateMemberIndex))
326329
327- getState(candidate).stateName should be(Follower )
330+ val state = getState(candidate)
331+ state.stateName should be(Follower )
332+ state.stateData.leaderMember should contain(anotherMemberIndex)
328333 }
329334
330335 " コマンドは保留し、フォロワーに降格した場合はリーダーに転送する" in {
@@ -440,6 +445,10 @@ class RaftActorCandidateSpec extends TestKit(ActorSystem()) with RaftActorSpecBa
440445 setState(candidate, Candidate , candidateData)
441446 candidate ! createAppendEntries(shardId, term1, leaderMemberIndex, index3, term1)
442447 expectMsg(AppendEntriesFailed (term1, candidateMemberIndex))
448+
449+ val state = getState(candidate)
450+ state.stateName should be(Follower )
451+ state.stateData.leaderMember should contain(leaderMemberIndex)
443452 }
444453
445454 " prevLogIndex の Term が prevLogTerm に一致するログエントリでない場合は AppendEntriesFailed を返す" in {
@@ -497,6 +506,7 @@ class RaftActorCandidateSpec extends TestKit(ActorSystem()) with RaftActorSpecBa
497506 val state = getState(candidate)
498507 state.stateName should be(Follower )
499508 state.stateData.currentTerm should be(leaderTerm)
509+ state.stateData.leaderMember should contain(leaderMemberIndex)
500510 }
501511
502512 " leaderCommit > commitIndex となる場合、 commitIndex に min(leaderCommit, 新規エントリの最後のインデックス) を設定" in {
0 commit comments