test(router): add unit tests and relay routing integration test - #80
Open
Sendi0011 wants to merge 1 commit into
Open
test(router): add unit tests and relay routing integration test#80Sendi0011 wants to merge 1 commit into
Sendi0011 wants to merge 1 commit into
Conversation
Author
|
GM @Mrwicks00 this trust you are doing great? this pr is ready for review. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Title:
test(router): add unit tests and relay routing integration testCloses: #47
Summary
Adds external test coverage for
PathFinderandRelayRouter, and an end-to-end relay routing integration test as specified in Issue #47. Also exposes theroutermodule publicly insrc/lib.rs, which was the only missing wiring preventing external tests from compiling.Changes
src/lib.rs— addedpub mod router;tests/router_test.rs— 9 unit tests:test_pathfinder_ranks_relay_adjacent_peer_first— 1-hop peer sorts before 5-hop peer regardless of input ordertest_pathfinder_handles_empty_connections— empty input returns empty, no panictest_pathfinder_unknown_peers_ranked_last— peers with no HopCounter entry sort to the endtest_pathfinder_follows_graph_edges_to_relay— PathFinder traverses MeshGraph edges to find relay proximitytest_relay_router_respects_target_fanout— 10 peers, fanout=3 → exactly 3 returnedtest_relay_router_falls_back_to_random_when_no_relay_path— all peers at 255 hops → still returnstarget_fanoutpeerstest_relay_router_returns_all_when_fanout_exceeds_peer_counttest_relay_router_empty_input_returns_emptytest_relay_router_zero_fanout_returns_emptytests/integration/relay_routing_test.rs— 3 integration tests:test_message_routes_to_relay_node— 4-node chain (Node0–Node1–Node2–Node3/Relay), message injected at Node0 reaches the relay ✓test_message_injected_at_relay_is_receivedtest_isolated_node_message_stays_at_originNote on MeshSimulator (#20): Since Issue #20 is not yet merged, a minimal
MeshBuilderharness is implemented inline in the integration test using the samePathFinder+RelayRouter+MeshGraph+HopCounterstack. When #20 lands, the harness can be swapped for the canonicalMeshSimulatorwith no changes to the test assertions.Test results