From 1d3edbfd29c96aaf57685706f24678d589f3bf65 Mon Sep 17 00:00:00 2001 From: Roland Sherwin Date: Tue, 12 Mar 2024 20:09:49 +0530 Subject: [PATCH] fix(test): await on the restart node rpc call --- sn_node/tests/common/client.rs | 18 ++++++++++-------- sn_node/tests/verify_data_location.rs | 8 ++++++-- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/sn_node/tests/common/client.rs b/sn_node/tests/common/client.rs index 10342ac1de..9e91a22ff3 100644 --- a/sn_node/tests/common/client.rs +++ b/sn_node/tests/common/client.rs @@ -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(()) } diff --git a/sn_node/tests/verify_data_location.rs b/sn_node/tests/verify_data_location.rs index 814de9eb4a..2393221200 100644 --- a/sn_node/tests/verify_data_location.rs +++ b/sn_node/tests/verify_data_location.rs @@ -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);