Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
akiradeveloper committed May 23, 2024
1 parent 57f9f6d commit 665edd7
Showing 1 changed file with 30 additions and 1 deletion.
31 changes: 30 additions & 1 deletion tests/lol-tests/tests/multi_raft.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,41 @@ use rand::Rng;
use serial_test::serial;
use std::sync::Arc;

#[serial]
#[tokio::test(flavor = "multi_thread")]
async fn N3_L100_K3_multi_raft_cluster() -> Result<()> {
let cluster = Arc::new(Cluster::new(3, 100).await?);

let mut futs = vec![];
for lane_id in 0..100 {
let cluster = cluster.clone();
let fut = async move {
cluster.add_server(lane_id, 0, 0).await?;
cluster.add_server(lane_id, 0, 1).await?;
cluster.add_server(lane_id, 0, 2).await?;

// Evenly distribute the leaders.
let leader = (lane_id % 3) as u8;
cluster
.admin(leader)
.send_timeout_now(TimeoutNow { lane_id })
.await?;

Ok::<(), anyhow::Error>(())
};
futs.push(fut);
}
futures::future::try_join_all(futs).await?;

Ok(())
}

const L: u32 = 20;
const REP: u32 = 300;

#[serial]
#[tokio::test(flavor = "multi_thread")]
async fn N3_L20_K3_multi_raft() -> Result<()> {
async fn N3_L20_K3_multi_raft_io() -> Result<()> {
let cluster = Arc::new(Cluster::new(3, L).await?);

let mut futs = vec![];
Expand Down

0 comments on commit 665edd7

Please sign in to comment.