From a12264b1af04e29fc0a35f5f6c6e75ddcde5ec1f Mon Sep 17 00:00:00 2001 From: Ian Clarke Date: Mon, 24 Nov 2025 18:37:06 -0600 Subject: [PATCH 1/2] ci: isolate six-peer test --- .github/workflows/ci.yml | 33 +++++++++++++++++++ crates/core/Cargo.toml | 3 +- crates/core/tests/connection_cap.rs | 1 + crates/core/tests/diagnose_connectivity.rs | 1 + crates/core/tests/gateway_inbound_identity.rs | 1 + crates/core/tests/large_network.rs | 1 + crates/core/tests/manual_network_test.rs | 1 + crates/core/tests/test_network_integration.rs | 1 + 8 files changed, 41 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 528484931..9f7167a9f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -130,6 +130,39 @@ jobs: river_message_flow_over_freenet_six_peers_five_rounds -- --ignored --exact + six_peer_connection_cap: + name: six-peer-connection-cap + needs: test_all + runs-on: freenet-default-runner + + env: + FREENET_LOG: error + CARGO_TARGET_DIR: ${{ github.workspace }}/target + + steps: + - name: Cancel Previous Runs + uses: styfle/cancel-workflow-action@0.12.1 + with: + access_token: ${{ github.token }} + + - uses: actions/checkout@v6 + + - uses: dtolnay/rust-toolchain@stable + with: + toolchain: stable + + - uses: Swatinem/rust-cache@v2 + with: + save-if: ${{ github.ref == 'refs/heads/main' }} + + - name: Run six-peer connection-cap test + run: > + cargo test -p freenet + --test connection_cap + --no-default-features + --features trace,websocket,redb,test-network + -- connection_cap_respected --nocapture + clippy_check: name: Clippy diff --git a/crates/core/Cargo.toml b/crates/core/Cargo.toml index 2d1190cf6..d9b1554b8 100644 --- a/crates/core/Cargo.toml +++ b/crates/core/Cargo.toml @@ -80,6 +80,7 @@ opentelemetry_sdk = { optional = true, version = "0.31", features = ["rt-tokio"] freenet-stdlib = { features = ["net"], workspace = true } console-subscriber = { version = "0.5.0", optional = true } tokio-stream = "0.1.17" +freenet-test-network = { version = "0.1.3", optional = true } [target.'cfg(windows)'.dependencies] winapi = { version = "0.3", features = ["sysinfoapi"] } @@ -91,7 +92,6 @@ arbitrary = { features = ["derive"], version = "1" } chrono = { features = ["arbitrary"], workspace = true } freenet-stdlib = { features = ["net", "testing"], workspace = true } freenet-macros = { path = "../freenet-macros" } -freenet-test-network = "0.1.4" httptest = "0.16" statrs = "0.18" tempfile = "3" @@ -111,3 +111,4 @@ trace-ot = ["opentelemetry-jaeger", "trace", "tracing-opentelemetry", "opentelem websocket = ["axum/ws"] testing = ["freenet-stdlib/testing"] console-subscriber = ["dep:console-subscriber"] +test-network = ["dep:freenet-test-network"] diff --git a/crates/core/tests/connection_cap.rs b/crates/core/tests/connection_cap.rs index 4342244fe..d5f2cbf16 100644 --- a/crates/core/tests/connection_cap.rs +++ b/crates/core/tests/connection_cap.rs @@ -1,3 +1,4 @@ +#![cfg(feature = "test-network")] //! Minimal repro harness for connection-cap enforcement. //! //! This test spins up a tiny network (2 gateways + 6 peers) with a low max-connections diff --git a/crates/core/tests/diagnose_connectivity.rs b/crates/core/tests/diagnose_connectivity.rs index e6096c33f..d7a8de79f 100644 --- a/crates/core/tests/diagnose_connectivity.rs +++ b/crates/core/tests/diagnose_connectivity.rs @@ -1,3 +1,4 @@ +#![cfg(feature = "test-network")] //! Diagnostic test to understand connectivity failures use freenet_test_network::{BuildProfile, FreenetBinary, TestNetwork}; diff --git a/crates/core/tests/gateway_inbound_identity.rs b/crates/core/tests/gateway_inbound_identity.rs index d48f7b6a7..c751d598f 100644 --- a/crates/core/tests/gateway_inbound_identity.rs +++ b/crates/core/tests/gateway_inbound_identity.rs @@ -1,3 +1,4 @@ +#![cfg(feature = "test-network")] //! Regression test: gateways must register inbound peers under their real identities //! rather than collapsing multiple connections under a placeholder. //! diff --git a/crates/core/tests/large_network.rs b/crates/core/tests/large_network.rs index 7020c4e23..b5f0950ec 100644 --- a/crates/core/tests/large_network.rs +++ b/crates/core/tests/large_network.rs @@ -1,3 +1,4 @@ +#![cfg(feature = "test-network")] //! Large-scale soak test using `freenet-test-network`. //! //! This test intentionally spins up a sizable network (2 gateways + N peers) and exercises the diff --git a/crates/core/tests/manual_network_test.rs b/crates/core/tests/manual_network_test.rs index f00de51da..e9e50ddbd 100644 --- a/crates/core/tests/manual_network_test.rs +++ b/crates/core/tests/manual_network_test.rs @@ -1,3 +1,4 @@ +#![cfg(feature = "test-network")] //! Manual test to inspect network logs use freenet_test_network::{BuildProfile, FreenetBinary, TestNetwork}; diff --git a/crates/core/tests/test_network_integration.rs b/crates/core/tests/test_network_integration.rs index 3373d5cd0..ac8572bce 100644 --- a/crates/core/tests/test_network_integration.rs +++ b/crates/core/tests/test_network_integration.rs @@ -1,3 +1,4 @@ +#![cfg(feature = "test-network")] //! Integration test demonstrating freenet-test-network usage //! //! This shows how much simpler tests become with the test-network crate From 1bc2476932a3fd07137c200bf1a1eb9c4f0b2c89 Mon Sep 17 00:00:00 2001 From: Ian Clarke Date: Mon, 24 Nov 2025 19:24:12 -0600 Subject: [PATCH 2/2] test: gate river smoke on test-network --- crates/core/tests/river_smoke.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/crates/core/tests/river_smoke.rs b/crates/core/tests/river_smoke.rs index 8b31bac81..8515fbf0b 100644 --- a/crates/core/tests/river_smoke.rs +++ b/crates/core/tests/river_smoke.rs @@ -1,3 +1,4 @@ +#![cfg(feature = "test-network")] //! Minimal riverctl propagation smoke test to reproduce intermittent "missing contract" errors. //! //! This intentionally runs outside CI (ignored) so it can be executed manually when debugging