Skip to content

Commit fec295e

Browse files
committed
test_p2p: add test cases with signaling/net loss
1 parent 1d46521 commit fec295e

1 file changed

Lines changed: 26 additions & 0 deletions

File tree

tests/test_p2p.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -596,6 +596,32 @@ def ClientServerExpectedFailureTest( server_extra_args=[], client_extra_args=[],
596596
_nat( _CLI_INT_V6, _CLI_GW_V6, 'full-cone' ),
597597
'udp', 1, _CTR_DIRECT_NO_TURN,
598598
( _CAND_IPV6_NAT, _CAND_IPV6_NAT ) ),
599+
600+
# Packet loss: verify that connection succeeds despite 20% outbound packet loss.
601+
# Route type is intentionally not checked. With outbound-only loss, the relay
602+
# path has a higher per-attempt round-trip success rate than the direct path:
603+
# the relay response arrives via the TURN server's inbound socket, bypassing the
604+
# lossy adapter, whereas the direct-path response must traverse the remote peer's
605+
# lossy adapter. Under aggressive nomination (first pair to succeed wins), relay
606+
# can beat the higher-priority direct path to nomination. This is current
607+
# behaviour; route optimisation can be addressed later.
608+
( 'full-cone NAT, 20% packet loss',
609+
[ '--mock-loss', '20' ] + _nat( _SRV_INT, _SRV_GW, 'full-cone' ),
610+
[ '--mock-loss', '20' ] + _nat( _CLI_INT, _CLI_GW, 'full-cone' ),
611+
None, 1, None, None ),
612+
613+
# Signaling impairment: verify connection succeeds despite lossy or duplicate
614+
# signals. Uses real loopback (no mock network), so the route is always 'local'.
615+
# Signaling loss only slows setup (the library retransmits rendezvous messages);
616+
# it does not affect route selection or ICE counter values in a predictable way.
617+
( 'no-mock native ICE, 30% signaling loss',
618+
[ '--signaling-loss', '30' ],
619+
[ '--signaling-loss', '30' ],
620+
'local', 1, None, None ),
621+
( 'no-mock native ICE, 50% signaling duplicates',
622+
[ '--signaling-dup', '50' ],
623+
[ '--signaling-dup', '50' ],
624+
'local', 1, None, None ),
599625
]
600626

601627
def ClientServerTest( server_extra_args=[], client_extra_args=[], expected_route=None, ice_impl=1, expected_counters=None, expected_candidates=None ):

0 commit comments

Comments
 (0)