diff --git a/xline-test-utils/Cargo.toml b/xline-test-utils/Cargo.toml index d5adf92ca..654fe305a 100644 --- a/xline-test-utils/Cargo.toml +++ b/xline-test-utils/Cargo.toml @@ -22,4 +22,5 @@ tokio = { version = "1.0", features = [ "fs", "macros", "net", + "signal", ] } diff --git a/xline-test-utils/src/bin/test_cluster.rs b/xline-test-utils/src/bin/test_cluster.rs new file mode 100644 index 000000000..0f8c6a708 --- /dev/null +++ b/xline-test-utils/src/bin/test_cluster.rs @@ -0,0 +1,19 @@ +//! The binary is to quickly setup a cluster for convenient testing +use tokio::signal; +use xline_test_utils::Cluster; + +#[tokio::main] +async fn main() { + let mut cluster = Cluster::new(3).await; + cluster.start().await; + + println!("cluster running"); + + for (id, addr) in cluster.addrs() { + println!("server id: {} addr: {}", id, addr); + } + + if let Err(e) = signal::ctrl_c().await { + eprintln!("Unable to listen for shutdown signal: {e}"); + } +}