Skip to content

Commit

Permalink
fix(test): ignore error while processing cmds
Browse files Browse the repository at this point in the history
  • Loading branch information
RolandSherwin authored and joshuef committed Mar 2, 2023
1 parent bc3b2fb commit 45d37d8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
3 changes: 2 additions & 1 deletion sn_node/src/node/flow_ctrl/tests/cmd_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -233,9 +233,10 @@ impl TestNode {
/// Tracks the cmds before executing them
pub(crate) async fn process_cmd(&mut self, cmd: Cmd) -> Result<Vec<Cmd>> {
self.msg_tracker.write().await.track(&cmd);
let cmd_string = cmd.to_string();
MyNode::process_cmd(cmd, &mut self.node)
.await
.wrap_err("Failed to process {cmd}")
.wrap_err(format!("Failed to process {cmd_string}"))
}

/// Handle and keep track of Msg from Peers
Expand Down
8 changes: 6 additions & 2 deletions sn_node/src/node/messaging/join_section.rs
Original file line number Diff line number Diff line change
Expand Up @@ -512,8 +512,12 @@ mod tests {
while let Some(msg) = get_next_msg(comm_rx).await {
let mut cmds = node.test_handle_msg_from_peer(msg, None).await;
while !cmds.is_empty() {
let new_cmds = node.process_cmd(cmds.remove(0)).await?;
cmds.extend(new_cmds);
match node.process_cmd(cmds.remove(0)).await {
Ok(new_cmds) => cmds.extend(new_cmds),
Err(err) => {
warn!("Error while processing cmd inside join_loop {err:?}")
}
}
}
}
}
Expand Down

0 comments on commit 45d37d8

Please sign in to comment.