test(net): speedup network tests (#1337)

This commit is contained in:
Matthias Seitz
2023-02-14 15:53:05 +01:00
committed by GitHub
parent 5361d5f834
commit 0aaf51d462
2 changed files with 4 additions and 7 deletions

View File

@ -158,9 +158,8 @@ impl Testnet<NoopProvider> {
/// Creates a new [`Testnet`] with the given number of peers
pub async fn try_create(num_peers: usize) -> Result<Self, NetworkError> {
let mut this = Testnet::default();
for _ in 0..num_peers {
this.add_peer().await?;
}
this.extend_peer_with_config((0..num_peers).map(|_| Default::default())).await?;
Ok(this)
}

View File

@ -15,7 +15,6 @@ async fn test_session_established_with_highest_version() {
reth_tracing::init_test_tracing();
let net = Testnet::create(2).await;
net.for_each(|peer| assert_eq!(0, peer.num_peers()));
let mut handles = net.handles();
@ -37,12 +36,11 @@ async fn test_session_established_with_highest_version() {
assert_eq!(handle1.peer_id(), &peer_id);
assert_eq!(status.version, EthVersion::Eth67 as u8);
}
_ => {
panic!("unexpected event")
ev => {
panic!("unexpected event {ev:?}")
}
}
}
handle.terminate().await;
}