TestRawNodeJointAutoLeave
This now needs an additional Ready cycle to apply the previous conf change,
so the finalizing conf change does too.
@@ -388,7 +388,6 @@ func TestRawNodeJointAutoLeave(t *testing.T) {
}
exp2Cs := pb.ConfState{Voters: []uint64{1}, Learners: []uint64{2}}
- t.Run("", func(t *testing.T) {
s := newTestMemoryStorage(withPeers(1))
rawNode, err := NewRawNode(newTestConfig(1, 10, 1, s))
if err != nil {
@@ -481,11 +480,16 @@ func TestRawNodeJointAutoLeave(t *testing.T) {
// Make it leader again. It should leave joint automatically after moving apply index.
rawNode.Campaign()
rd = rawNode.Ready()
+ t.Log(DescribeReady(rd, nil))
s.Append(rd.Entries)
rawNode.Advance(rd)
rd = rawNode.Ready()
+ t.Log(DescribeReady(rd, nil))
+ s.Append(rd.Entries)
+ rawNode.Advance(rd)
+ rd = rawNode.Ready()
+ t.Log(DescribeReady(rd, nil))
s.Append(rd.Entries)
-
// Check that the right ConfChange comes out.
if len(rd.Entries) != 1 || rd.Entries[0].Type != pb.EntryConfChangeV2 {
t.Fatalf("expected exactly one more entry, got %+v", rd)
@@ -503,7 +507,6 @@ func TestRawNodeJointAutoLeave(t *testing.T) {
if exp := exp2Cs; !reflect.DeepEqual(&exp, cs) {
t.Fatalf("exp:\n%+v\nact:\n%+v", exp, cs)
}
- })
}
// TestRawNodeProposeAddDuplicateNode ensures that two proposes to add the same node should
