mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
TestSingleNodeCommit
Signed-off-by: Tobias Grieger <tobias.b.grieger@gmail.com>
This commit is contained in:
parent
99adcaa299
commit
d6f3e88a52
@ -730,11 +730,18 @@ func TestLearnerLogReplication(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSingleNodeCommit(t *testing.T) {
|
||||
tt := newNetwork(nil)
|
||||
s := newTestMemoryStorage(withPeers(1))
|
||||
cfg := newTestConfig(1, 10, 1, s)
|
||||
r := newRaft(cfg)
|
||||
tt := newNetwork(r)
|
||||
tt.send(pb.Message{From: 1, To: 1, Type: pb.MsgHup})
|
||||
tt.send(pb.Message{From: 1, To: 1, Type: pb.MsgProp, Entries: []pb.Entry{{Data: []byte("some data")}}})
|
||||
tt.send(pb.Message{From: 1, To: 1, Type: pb.MsgProp, Entries: []pb.Entry{{Data: []byte("some data")}}})
|
||||
|
||||
rd := newReady(r, &SoftState{}, pb.HardState{})
|
||||
s.Append(rd.Entries)
|
||||
r.advance(rd)
|
||||
|
||||
sm := tt.peers[1].(*raft)
|
||||
if sm.raftLog.committed != 3 {
|
||||
t.Errorf("committed = %d, want %d", sm.raftLog.committed, 3)
|
||||
|
Loading…
x
Reference in New Issue
Block a user