Skip to content

Commit

Permalink
Fix tests that require multiple connections per IP
Browse files Browse the repository at this point in the history
  • Loading branch information
teor2345 committed Jun 19, 2023
1 parent 7963297 commit 85fda39
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion zebra-network/src/peer_set/set/tests/vectors.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! Fixed test vectors for the peer set.

use std::{iter, time::Duration};
use std::{cmp::max, iter, time::Duration};

use tokio::time::timeout;
use tower::{Service, ServiceExt};
Expand All @@ -12,6 +12,7 @@ use zebra_chain::{

use super::{PeerSetBuilder, PeerVersions};
use crate::{
constants::MAX_CONNS_PER_IP,
peer::{ClientRequest, MinimumPeerVersion},
peer_set::inventory_registry::InventoryStatus,
protocol::external::{types::Version, InventoryHash},
Expand Down Expand Up @@ -144,6 +145,7 @@ fn peer_set_ready_multiple_connections() {
let (mut peer_set, _peer_set_guard) = PeerSetBuilder::new()
.with_discover(discovered_peers)
.with_minimum_peer_version(minimum_peer_version.clone())
.max_conns_per_ip(max(3, MAX_CONNS_PER_IP))
.build();

// Get peerset ready
Expand Down Expand Up @@ -257,6 +259,7 @@ fn peer_set_route_inv_empty_registry() {
let (mut peer_set, _peer_set_guard) = PeerSetBuilder::new()
.with_discover(discovered_peers)
.with_minimum_peer_version(minimum_peer_version.clone())
.max_conns_per_ip(max(2, MAX_CONNS_PER_IP))
.build();

// Get peerset ready
Expand Down Expand Up @@ -339,6 +342,7 @@ fn peer_set_route_inv_advertised_registry_order(advertised_first: bool) {
let (mut peer_set, mut peer_set_guard) = PeerSetBuilder::new()
.with_discover(discovered_peers)
.with_minimum_peer_version(minimum_peer_version.clone())
.max_conns_per_ip(max(2, MAX_CONNS_PER_IP))
.build();

// Advertise some inventory
Expand Down Expand Up @@ -446,6 +450,7 @@ fn peer_set_route_inv_missing_registry_order(missing_first: bool) {
let (mut peer_set, mut peer_set_guard) = PeerSetBuilder::new()
.with_discover(discovered_peers)
.with_minimum_peer_version(minimum_peer_version.clone())
.max_conns_per_ip(max(2, MAX_CONNS_PER_IP))
.build();

// Mark some inventory as missing
Expand Down

0 comments on commit 85fda39

Please sign in to comment.