mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
TestNodeAdvance
Switched this to baking the conf changes into the initial state to have fewer cycles to walk through in the test. Signed-off-by: Tobias Grieger <tobias.b.grieger@gmail.com>
This commit is contained in:
parent
0d9a6061c3
commit
b2dba1c86c
@ -784,7 +784,7 @@ func TestNodeRestartFromSnapshot(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestNodeAdvance(t *testing.T) {
|
||||
storage := NewMemoryStorage()
|
||||
storage := newTestMemoryStorage(withPeers(1))
|
||||
c := &Config{
|
||||
ID: 1,
|
||||
ElectionTick: 10,
|
||||
@ -793,21 +793,17 @@ func TestNodeAdvance(t *testing.T) {
|
||||
MaxSizePerMsg: noLimit,
|
||||
MaxInflightMsgs: 256,
|
||||
}
|
||||
ctx, cancel, n := newNodeTestHarness(t, context.Background(), c, Peer{ID: 1})
|
||||
ctx, cancel, n := newNodeTestHarness(t, context.Background(), c)
|
||||
defer cancel()
|
||||
rd := <-n.Ready()
|
||||
|
||||
n.Campaign(ctx)
|
||||
rd := readyWithTimeout(n)
|
||||
// Commit empty entry.
|
||||
storage.Append(rd.Entries)
|
||||
n.Advance()
|
||||
|
||||
n.Campaign(ctx)
|
||||
<-n.Ready()
|
||||
|
||||
n.Propose(ctx, []byte("foo"))
|
||||
select {
|
||||
case rd = <-n.Ready():
|
||||
t.Fatalf("unexpected Ready before Advance: %+v", rd)
|
||||
case <-time.After(time.Millisecond):
|
||||
}
|
||||
rd = readyWithTimeout(n)
|
||||
storage.Append(rd.Entries)
|
||||
n.Advance()
|
||||
select {
|
||||
|
Loading…
x
Reference in New Issue
Block a user