Skip to content

Commit

Permalink
test: fix: connectivity-check
Browse files Browse the repository at this point in the history
  • Loading branch information
akiradeveloper committed Oct 30, 2024
1 parent ed1de94 commit 22f1fac
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 7 deletions.
5 changes: 0 additions & 5 deletions tests/env/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use anyhow::Result;
use core::error;
use std::collections::HashMap;
use std::sync::Arc;
use std::sync::Once;
Expand Down Expand Up @@ -200,10 +199,6 @@ impl Env {
.or_insert_with(|| port_check::free_local_ipv4_port().unwrap());
let snap_states = self.penv.as_mut().map(|env| env.get(id));
let node = Node::new(id, free_port, self.n_shards, snap_states).unwrap();
port_check::is_port_reachable_with_timeout(
node.address().to_string(),
Duration::from_secs(5),
);
self.nodes.insert(id, node);
}

Expand Down
2 changes: 1 addition & 1 deletion tests/sorock-tests/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ impl Builder {
let mut env = Env::new(p, self.with_persistency, self.with_logging);
for id in 0..n {
env.add_node(id);
env.check_connectivity(0).await?;
env.check_connectivity(id).await?;
}
Ok(Cluster { env })
}
Expand Down
4 changes: 3 additions & 1 deletion tests/sorock-tests/tests/6_persistency.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,11 @@ async fn n3_restore() -> Result<()> {
tokio::time::sleep(Duration::from_secs(1)).await;

cluster.env().add_node(0);
cluster.env().check_connectivity(0).await?;
cluster.env().add_node(1);
cluster.env().check_connectivity(1).await?;
// Wait for election.
tokio::time::sleep(Duration::from_secs(5)).await;
tokio::time::sleep(Duration::from_secs(30)).await;
assert_eq!(cluster.user(1).read(0).await?, cur_state);

Ok(())
Expand Down

0 comments on commit 22f1fac

Please sign in to comment.