Skip to content

Commit

Permalink
test: add a test cluster binary in xline-test-utils
Browse files Browse the repository at this point in the history
  • Loading branch information
bsbds authored and Phoenix500526 committed Jun 22, 2023
1 parent 17ba46b commit c60a67d
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
1 change: 1 addition & 0 deletions xline-test-utils/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,5 @@ tokio = { version = "1.0", features = [
"fs",
"macros",
"net",
"signal",
] }
19 changes: 19 additions & 0 deletions xline-test-utils/src/bin/test_cluster.rs
Original file line number Diff line number Diff line change
@@ -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}");
}
}

0 comments on commit c60a67d

Please sign in to comment.