Browse Source

Merge pull request #2005 from xiang90/kill_todo

etcdserver: kill a todo in test
Xiang Li 11 years ago
parent
commit
7ce0fc782e
1 changed files with 1 additions and 18 deletions
  1. 1 18
      etcdserver/server_test.go

+ 1 - 18
etcdserver/server_test.go

@@ -883,28 +883,11 @@ func TestSnapshot(t *testing.T) {
 	n := raft.StartNode(0xBAD0, mustMakePeerSlice(t, 0xBAD0), 10, 1, s)
 	n := raft.StartNode(0xBAD0, mustMakePeerSlice(t, 0xBAD0), 10, 1, s)
 	defer n.Stop()
 	defer n.Stop()
 
 
-	// Progress the node to the point where it has something to snapshot.
-	// TODO(bdarnell): this could be improved with changes in the raft internals.
-	// First, we must apply the initial conf changes so we can have an election.
-	rd := <-n.Ready()
-	s.Append(rd.Entries)
-	for _, e := range rd.CommittedEntries {
-		if e.Type == raftpb.EntryConfChange {
-			var cc raftpb.ConfChange
-			err := cc.Unmarshal(e.Data)
-			if err != nil {
-				t.Fatal(err)
-			}
-			n.ApplyConfChange(cc)
-		}
-	}
-	n.Advance()
-
 	// Now we can have an election and persist the rest of the log.
 	// Now we can have an election and persist the rest of the log.
 	// This causes HardState.Commit to advance. HardState.Commit must
 	// This causes HardState.Commit to advance. HardState.Commit must
 	// be > 0 to snapshot.
 	// be > 0 to snapshot.
 	n.Campaign(context.Background())
 	n.Campaign(context.Background())
-	rd = <-n.Ready()
+	rd := <-n.Ready()
 	s.Append(rd.Entries)
 	s.Append(rd.Entries)
 	n.Advance()
 	n.Advance()