Skip to content

Commit

Permalink
test base node stop
Browse files Browse the repository at this point in the history
  • Loading branch information
SWvheerden committed Aug 26, 2024
1 parent 1ea32c5 commit a6c6abf
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions integration_tests/src/base_node_process.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ use std::{
sync::Arc,
time::Duration,
};

use std::net::TcpListener;
use minotari_app_utilities::identity_management::save_as_json;
use minotari_node::{config::GrpcMethod, run_base_node, BaseNodeConfig, MetricsConfig};
use minotari_node_grpc_client::BaseNodeGrpcClient;
Expand Down Expand Up @@ -106,11 +106,10 @@ pub async fn spawn_base_node_with_config(

base_node_identity = node_ps.identity.clone();
} else {
// each spawned wallet will use different ports
// each spawned base node will use different ports
port = get_port(18000..18499).unwrap();
grpc_port = get_port(18500..18999).unwrap();
// create a new temporary directory
// temp_dir_path = tempdir().unwrap().path().to_path_buf();
temp_dir_path = world
.current_base_dir
.as_ref()
Expand Down Expand Up @@ -259,5 +258,17 @@ impl BaseNodeProcess {

pub fn kill(&mut self) {
self.kill_signal.trigger();
loop{
// lets wait till the port is cleared
if TcpListener::bind(("127.0.0.1", self.port)).is_ok() {
break;
}
}
loop{
// lets wait till the port is cleared
if TcpListener::bind(("127.0.0.1", self.grpc_port)).is_ok() {
break;
}
}
}
}

0 comments on commit a6c6abf

Please sign in to comment.