Repository navigation
test(network): Add IPv6-only network test case for TCP server - #7629
AsadShahid04 wants to merge 4 commits into
Conversation
|
👋 Hi AsadShahid04! Thank you for contributing to ai-dynamo/dynamo. Just a reminder: The 🚀 |
WalkthroughAdded test coverage for IPv6-only network environments by introducing a test-only Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@lib/runtime/src/pipeline/network/tcp/server.rs`:
- Around line 686-687: The test is binding to a non-standard ULA address
(IpAddr::from([0xfd00, 0xdead, 0xbeef, 0, 0, 0, 0, 1])) which can be unavailable
on CI; replace those occurrences with the IPv6 loopback address (::1) to ensure
deterministic binding (e.g., use
std::net::IpAddr::V6(std::net::Ipv6Addr::LOCALHOST) or IpAddr::from_str("::1")
wherever IpAddr::from([...]) is currently used in this file, including the
blocks around the shown IpAddr::from call and the similar code at the other
affected region).
- Around line 681-683: The test only simulates Error::LocalIpAddressNotFound
from Ipv6OnlyResolver::local_ip(), missing the real failure mode
(StrategyError/non-LocalIpAddressNotFound) that triggered the regression; add a
new test variant (or extend the existing one) where the mocked/local
Ipv6OnlyResolver::local_ip() returns a non-LocalIpAddressNotFound error (e.g.,
the StrategyError variant from the local-ip-address::Error enum) and assert the
server fallback/handling behaves as expected; update the related tests around
the same area (the other cases referenced in the comment) so both
LocalIpAddressNotFound and StrategyError paths are covered for local_ip() and
exercise the alternate code path that previously regressed.
- Line 830: Replace the panic-prone unwrap on parsing tcp_info.address into a
SocketAddr with proper error handling: replace let socket_addr =
tcp_info.address.parse::<std::net::SocketAddr>().unwrap(); with code that
matches the Result (e.g., match or .map_err and ?), and return or log a clear,
contextual error (including the offending tcp_info.address and a hint about IPv6
bracketed form) so callers of this code (where socket_addr is used) can handle
malformed addresses instead of crashing. Use the unique identifiers
tcp_info.address, socket_addr, and std::net::SocketAddr when locating the
change.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 32e2030f-e297-4aa9-b566-212ff58e50a1
📒 Files selected for processing (1)
lib/runtime/src/pipeline/network/tcp/server.rs
Fixes ai-dynamo#7619 Add comprehensive test case for IPv6-only network environments. This validates that the TCP stream server properly handles the case where IPv4 is unavailable and falls back to IPv6. - Added Ipv6OnlyResolver mock for testing IPv6-only scenarios - Added test_tcp_stream_server_ipv6_only_network test case - Verifies proper fallback behavior and address binding - Ensures error handling works correctly on IPv6-only systems Signed-off-by: Asad Shahid <[email protected]>
e7b4095 to
419842c
Compare
…tion IPv6 addresses must be wrapped in brackets when combined with a port number to create a valid SocketAddr string (e.g., [fd00::1]:8080). The previous implementation simply formatted as 'address:port' which resulted in ambiguous strings like 'fd00::1:8080' that cannot be parsed correctly. Update the address formatting logic to: 1. Check if the address contains ':' (indicating IPv6) 2. Wrap IPv6 addresses in brackets before appending port 3. Keep IPv4 addresses unchanged This ensures both IPv4 and IPv6 addresses are properly formatted and can be parsed as SocketAddr. Fixes ai-dynamo#7619: Support IPv6-only environments in IP resolution Signed-off-by: Asad Shahid <[email protected]>
The start() function was formatting IPv6 addresses without brackets, causing bind failures on IPv6-only networks. The address format "fd00:dead:beef::1:0" is invalid; it must be "[fd00:dead:beef::1]:0". Apply the same IPv6 bracket-wrapping fix to start() that was already applied to register(). Signed-off-by: Asad Shahid <[email protected]>
Replace fd00:dead:beef::1 ULA address with ::1 (IPv6 loopback) in Ipv6OnlyResolver. The ULA address is not assigned on CI hosts, causing bind to fail with 'address not available'. IPv6 loopback is guaranteed to exist on all hosts. Signed-off-by: Asad Shahid <[email protected]>
|
Hi @AsadShahid04, what's the relationship between #7632 and #7627 - does one supersede the other? Also, can the testing (#7629) be wrapped up into a single PR along with the fix? Ideally there's only 1 PR to fix this instead of 3. |
|
This PR is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days. |
|
This PR has been closed due to inactivity. If you believe this PR is still relevant, please feel free to reopen it with additional context or information. |
Fixes #7619
Add comprehensive test case for IPv6-only network environments. This
validates that the TCP stream server properly handles the case where
IPv4 is unavailable and falls back to IPv6.
Summary by CodeRabbit