Skip to content

Commit

Permalink
squash commits
Browse files Browse the repository at this point in the history
Signed-off-by: Fullstop000 <[email protected]>
  • Loading branch information
Fullstop000 committed Dec 17, 2019
1 parent 7a7a0f2 commit 8ed4829
Show file tree
Hide file tree
Showing 12 changed files with 701 additions and 777 deletions.
6 changes: 1 addition & 5 deletions harness/src/interface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,7 @@ impl Interface {
/// Read messages out of the raft.
pub fn read_messages(&mut self) -> Vec<Message> {
match self.raft {
Some(_) => {
let mut msgs = self.msgs.drain(..).collect::<Vec<_>>();
msgs.extend(self.groups.take_messages());
msgs
}
Some(_) => self.msgs.drain(..).collect(),
None => vec![],
}
}
Expand Down
9 changes: 6 additions & 3 deletions harness/tests/integration_cases/test_raft.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,10 @@ fn next_ents(r: &mut Raft<MemStorage>, s: &MemStorage) -> Vec<Entry> {

fn do_send_append(raft: &mut Raft<MemStorage>, to: u64) {
let mut prs = raft.take_prs();
raft.send_append(to, &mut prs);
{
let pr = prs.get_mut(to).unwrap();
raft.send_append(to, pr);
}
raft.set_prs(prs);
}

Expand Down Expand Up @@ -1193,7 +1196,7 @@ fn test_handle_msg_append() {
);

sm.become_follower(2, INVALID_ID);
sm.handle_replication(m);
sm.handle_append_message(m);
if sm.raft_log.last_index() != w_index {
panic!(
"#{}: last_index = {}, want {}",
Expand Down Expand Up @@ -1360,7 +1363,7 @@ fn test_msg_append_response_wait_reset() {

// The new leader has just emitted a new Term 4 entry; consume those messages
// from the outgoing queue.
sm.bcast_append(None);
sm.bcast_append();
sm.read_messages();

// Node 2 acks the first entry, making it committed.
Expand Down
Loading

0 comments on commit 8ed4829

Please sign in to comment.