From 22f1fac2513f4e97bb88cf1093dc70e1b7581e64 Mon Sep 17 00:00:00 2001 From: Akira Hayakawa Date: Wed, 30 Oct 2024 01:59:32 +0000 Subject: [PATCH] test: fix: connectivity-check --- tests/env/src/lib.rs | 5 ----- tests/sorock-tests/src/lib.rs | 2 +- tests/sorock-tests/tests/6_persistency.rs | 4 +++- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/tests/env/src/lib.rs b/tests/env/src/lib.rs index 44c1d5ba..41b76406 100644 --- a/tests/env/src/lib.rs +++ b/tests/env/src/lib.rs @@ -1,5 +1,4 @@ use anyhow::Result; -use core::error; use std::collections::HashMap; use std::sync::Arc; use std::sync::Once; @@ -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); } diff --git a/tests/sorock-tests/src/lib.rs b/tests/sorock-tests/src/lib.rs index 68af61d1..54233ef1 100644 --- a/tests/sorock-tests/src/lib.rs +++ b/tests/sorock-tests/src/lib.rs @@ -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 }) } diff --git a/tests/sorock-tests/tests/6_persistency.rs b/tests/sorock-tests/tests/6_persistency.rs index b3f556ec..cc7d0f6b 100644 --- a/tests/sorock-tests/tests/6_persistency.rs +++ b/tests/sorock-tests/tests/6_persistency.rs @@ -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(())