Skip to content

Commit 805ad6d

Browse files
committed
test(p2p): use common driver definition
1 parent 9ac6156 commit 805ad6d

File tree

2 files changed

+36
-190
lines changed

2 files changed

+36
-190
lines changed

node/testing/src/scenarios/driver.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use crate::{cluster::ClusterNodeId, node::RustNodeTestingConfig, scenario::Scena
1414

1515
use super::ClusterRunner;
1616

17-
fn match_addr_with_port_and_peer_id(
17+
pub fn match_addr_with_port_and_peer_id(
1818
port: u16,
1919
peer_id: PeerId,
2020
) -> impl Fn(&P2pConnectionOutgoingInitOpts) -> bool {
@@ -26,7 +26,7 @@ fn match_addr_with_port_and_peer_id(
2626
}
2727
}
2828

29-
fn get_peers_iter(
29+
pub fn get_peers_iter(
3030
data: &serde_json::Value,
3131
) -> Option<impl Iterator<Item = Option<(&str, i64, &str)>>> {
3232
let iter = data
@@ -45,7 +45,7 @@ fn get_peers_iter(
4545
Some(iter)
4646
}
4747

48-
const PEERS_QUERY: &str = r#"query {
48+
pub const PEERS_QUERY: &str = r#"query {
4949
getPeers {
5050
host
5151
libp2pPort
@@ -92,7 +92,7 @@ pub fn as_connection_finalized_event(event: &Event) -> Option<(&PeerId, &Result<
9292
}
9393
}
9494

95-
fn identify_event(peer_id: PeerId) -> impl Fn(ClusterNodeId, &Event, &State) -> bool {
95+
pub fn identify_event(peer_id: PeerId) -> impl Fn(ClusterNodeId, &Event, &State) -> bool {
9696
move |_, event, _| {
9797
matches!(
9898
event,
@@ -278,6 +278,10 @@ impl<'cluster> Driver<'cluster> {
278278
&self.runner
279279
}
280280

281+
pub fn inner_mut(&mut self) -> &mut ClusterRunner<'cluster> {
282+
&mut self.runner
283+
}
284+
281285
#[allow(dead_code)]
282286
pub fn into_inner(self) -> ClusterRunner<'cluster> {
283287
self.runner

0 commit comments

Comments
 (0)