Skip to content
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

47 changes: 46 additions & 1 deletion apps/freenet-ping/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions apps/freenet-ping/app/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ humantime = "2.2.0"

[dev-dependencies]
freenet = { path = "../../../crates/core" }
test-log = "0.2"
testresult = { workspace = true }

[lib]
Expand Down
18 changes: 5 additions & 13 deletions apps/freenet-ping/app/tests/run_app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use rand::SeedableRng;
use testresult::TestResult;
use tokio::{select, time::sleep, time::timeout};
use tokio_tungstenite::connect_async;
use tracing::{level_filters::LevelFilter, span, Instrument, Level};
use tracing::{span, Instrument, Level};

use common::{
base_node_test_config, base_node_test_config_with_rng, gw_config_from_path,
Expand Down Expand Up @@ -171,10 +171,8 @@ async fn collect_node_diagnostics(
Ok(())
}

#[tokio::test(flavor = "multi_thread")]
#[test_log::test(tokio::test(flavor = "multi_thread"))]
async fn test_node_diagnostics_query() -> TestResult {
freenet::config::set_logger(Some(LevelFilter::DEBUG), None);

// Setup network sockets for the gateway and client node
let network_socket_gw = TcpListener::bind("127.0.0.1:0")?;
let ws_api_port_socket_gw = TcpListener::bind("127.0.0.1:0")?;
Expand Down Expand Up @@ -463,10 +461,8 @@ async fn test_node_diagnostics_query() -> TestResult {
}

#[ignore = "this test currently fails and we are workign on fixing it"]
#[tokio::test(flavor = "multi_thread")]
#[test_log::test(tokio::test(flavor = "multi_thread"))]
async fn test_ping_multi_node() -> TestResult {
freenet::config::set_logger(Some(LevelFilter::DEBUG), None);

// Setup network sockets for the gateway
let network_socket_gw = TcpListener::bind("127.0.0.1:0")?;

Expand Down Expand Up @@ -1092,10 +1088,8 @@ async fn test_ping_multi_node() -> TestResult {
}

#[ignore = "this test currently fails and we are workign on fixing it"]
#[tokio::test(flavor = "multi_thread")]
#[test_log::test(tokio::test(flavor = "multi_thread"))]
async fn test_ping_application_loop() -> TestResult {
freenet::config::set_logger(Some(LevelFilter::DEBUG), None);

// Setup network sockets for the gateway
let network_socket_gw = TcpListener::bind("127.0.0.1:0")?;

Expand Down Expand Up @@ -1520,7 +1514,7 @@ async fn test_ping_application_loop() -> TestResult {
}

#[cfg(feature = "manual-tests")]
#[tokio::test(flavor = "multi_thread")]
#[test_log::test(tokio::test(flavor = "multi_thread"))]
async fn test_ping_partially_connected_network() -> TestResult {
/*
* This test verifies how subscription propagation works in a partially connected network.
Expand Down Expand Up @@ -1551,8 +1545,6 @@ async fn test_ping_partially_connected_network() -> TestResult {
const NUM_REGULAR_NODES: usize = 7;
const CONNECTIVITY_RATIO: f64 = 0.5; // Controls connectivity between regular nodes

// Configure logging
freenet::config::set_logger(Some(LevelFilter::DEBUG), None);
tracing::info!(
"Starting test with {} gateways and {} regular nodes (connectivity ratio: {})",
NUM_GATEWAYS,
Expand Down
11 changes: 5 additions & 6 deletions apps/freenet-ping/app/tests/run_app_blocked_peers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ use common::{
base_node_test_config, get_all_ping_states, gw_config_from_path, ping_states_equal, APP_TAG,
PACKAGE_DIR, PATH_TO_CONTRACT,
};
use freenet::{config::set_logger, local_node::NodeConfig, server::serve_gateway};
use freenet::{local_node::NodeConfig, server::serve_gateway};
use freenet_ping_app::ping_client::{
wait_for_get_response, wait_for_put_response, wait_for_subscribe_response,
};
Expand All @@ -61,7 +61,7 @@ use futures::FutureExt;
use testresult::TestResult;
use tokio::{select, time::sleep};
use tokio_tungstenite::connect_async;
use tracing::{level_filters::LevelFilter, span, Instrument, Level};
use tracing::{span, Instrument, Level};

/// Configuration for blocked peers test variants
#[derive(Debug, Clone)]
Expand Down Expand Up @@ -98,7 +98,6 @@ async fn run_blocked_peers_test(config: BlockedPeersConfig) -> TestResult {
"debug,freenet::operations::subscribe=trace,freenet::contract=trace",
);
}
set_logger(Some(LevelFilter::DEBUG), None);

tracing::info!("Starting {} blocked peers test...", config.test_name);

Expand Down Expand Up @@ -788,7 +787,7 @@ async fn run_blocked_peers_test(config: BlockedPeersConfig) -> TestResult {
}

/// Standard blocked peers test (baseline)
#[tokio::test(flavor = "multi_thread")]
#[test_log::test(tokio::test(flavor = "multi_thread"))]
#[ignore]
async fn test_ping_blocked_peers() -> TestResult {
run_blocked_peers_test(BlockedPeersConfig {
Expand All @@ -808,7 +807,7 @@ async fn test_ping_blocked_peers() -> TestResult {
}

/// Simple blocked peers test
#[tokio::test(flavor = "multi_thread")]
#[test_log::test(tokio::test(flavor = "multi_thread"))]
#[ignore]
async fn test_ping_blocked_peers_simple() -> TestResult {
run_blocked_peers_test(BlockedPeersConfig {
Expand All @@ -835,7 +834,7 @@ async fn test_ping_blocked_peers_simple() -> TestResult {
// Test passes functionally (PUT/GET/Subscribe/state propagation all work) but
// fails with "Connection reset without closing handshake" during cleanup.
// Likely a test teardown race rather than functional bug.
#[tokio::test(flavor = "multi_thread")]
#[test_log::test(tokio::test(flavor = "multi_thread"))]
#[ignore]
async fn test_ping_blocked_peers_solution() -> TestResult {
run_blocked_peers_test(BlockedPeersConfig {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,13 @@ use futures::FutureExt;
use testresult::TestResult;
use tokio::{select, time::timeout};
use tokio_tungstenite::connect_async;
use tracing::{level_filters::LevelFilter, span, Instrument, Level};
use tracing::{span, Instrument, Level};

use common::{base_node_test_config, gw_config_from_path, APP_TAG, PACKAGE_DIR, PATH_TO_CONTRACT};

#[tokio::test(flavor = "multi_thread")]
#[test_log::test(tokio::test(flavor = "multi_thread"))]
#[ignore = "Test has never worked - nodes fail on startup with channel closed errors"]
async fn test_ping_partially_connected_network() -> TestResult {
freenet::config::set_logger(Some(LevelFilter::DEBUG), None);
/*
* This test verifies how subscription propagation works in a partially connected network.
*
Expand Down Expand Up @@ -68,8 +67,6 @@ async fn test_ping_partially_connected_network() -> TestResult {
const NUM_REGULAR_NODES: usize = 7;
const CONNECTIVITY_RATIO: f64 = 0.3; // Controls connectivity between regular nodes

// Configure logging
freenet::config::set_logger(Some(LevelFilter::DEBUG), None);
println!(
"Starting test with {NUM_GATEWAYS} gateways and {NUM_REGULAR_NODES} regular nodes (connectivity ratio: {CONNECTIVITY_RATIO})"
);
Expand Down
5 changes: 1 addition & 4 deletions apps/freenet-ping/app/tests/test_50_node_operations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,16 @@ use std::{net::TcpListener, path::PathBuf, time::Duration};
use testresult::TestResult;
use tokio::{select, time::timeout};
use tokio_tungstenite::connect_async;
use tracing::level_filters::LevelFilter;

use common::{base_node_test_config, gw_config_from_path, APP_TAG, PACKAGE_DIR, PATH_TO_CONTRACT};

const NUM_GATEWAYS: usize = 3; // Multiple gateways to distribute load
const NUM_REGULAR_NODES: usize = 47; // 3 + 47 = 50 total
const CONNECTIVITY_RATIO: f64 = 0.1; // 10% connectivity to reduce network load

#[tokio::test(flavor = "multi_thread")]
#[test_log::test(tokio::test(flavor = "multi_thread"))]
#[ignore = "large scale test - run manually"]
async fn test_50_node_operations() -> TestResult {
freenet::config::set_logger(Some(LevelFilter::INFO), None);

println!("🚀 Starting 50-node operations test");
println!(" Gateway nodes: {NUM_GATEWAYS}");
println!(" Regular nodes: {NUM_REGULAR_NODES}");
Expand Down
10 changes: 2 additions & 8 deletions apps/freenet-ping/app/tests/test_connection_timing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,12 @@ use futures::FutureExt;
use testresult::TestResult;
use tokio::{select, time::timeout};
use tokio_tungstenite::connect_async;
use tracing::{level_filters::LevelFilter, span, Instrument, Level};
use tracing::{span, Instrument, Level};

use common::{base_node_test_config, gw_config_from_path};

#[tokio::test(flavor = "multi_thread")]
#[test_log::test(tokio::test(flavor = "multi_thread"))]
async fn test_connection_timing() -> TestResult {
// Minimal logging to reduce noise
freenet::config::set_logger(
Some(LevelFilter::WARN),
Some("freenet::transport=info,freenet_core::transport=info".to_string()),
);

println!("🔧 Testing connection timing with 2 nodes");

// Setup only 2 nodes to minimize complexity
Expand Down
Loading