Skip to content

Commit

Permalink
fix(test): await on the restart node rpc call
Browse files Browse the repository at this point in the history
  • Loading branch information
RolandSherwin authored and jacderida committed Mar 13, 2024
1 parent 3050779 commit 1d3edbf
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 10 deletions.
18 changes: 10 additions & 8 deletions sn_node/tests/common/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -387,14 +387,16 @@ impl Droplet {
) -> Result<()> {
let mut rpc_client = get_safenode_manager_rpc_client(daemon_endpoint).await?;

let _response = rpc_client.restart_node_service(Request::new(NodeServiceRestartRequest {
peer_id: peer_id.to_bytes(),
delay_millis: 0,
retain_peer_id,
}));

println!("Node restart requested to RPC service at {daemon_endpoint}");
info!("Node restart requested to RPC service at {daemon_endpoint}");
let _response = rpc_client
.restart_node_service(Request::new(NodeServiceRestartRequest {
peer_id: peer_id.to_bytes(),
delay_millis: 0,
retain_peer_id,
}))
.await?;

println!("Node restart requested to safenodemand {daemon_endpoint}");
info!("Node restart requested to safenodemand {daemon_endpoint}");

Ok(())
}
Expand Down
8 changes: 6 additions & 2 deletions sn_node/tests/verify_data_location.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,11 +149,15 @@ async fn verify_data_location() -> Result<()> {
let response = rpc_client
.node_info(Request::new(NodeInfoRequest {}))
.await?;
let peer_id = PeerId::from_bytes(&response.get_ref().peer_id)?;
let new_peer_id = PeerId::from_bytes(&response.get_ref().peer_id)?;
// The below indexing assumes that, the way we do iteration to retrieve all_peers inside get_all_rpc_addresses
// and get_all_peer_ids is the same as how we do the iteration inside NodeRestart.
// todo: make this more cleaner.
all_peers[node_index] = peer_id;
if all_peers[node_index] == new_peer_id {
error!("new and old peer id are the same {new_peer_id:?}");
println!("new and old peer id are the same {new_peer_id:?}");
}
all_peers[node_index] = new_peer_id;
node_index += 1;

print_node_close_groups(&all_peers);
Expand Down

0 comments on commit 1d3edbf

Please sign in to comment.