Skip to content

test(network): Add IPv6-only network test case for TCP server - #7629

Closed
AsadShahid04 wants to merge 4 commits into
ai-dynamo:mainfrom
AsadShahid04:fix/ipv6-support-7619
Closed

AsadShahid04 wants to merge 4 commits into
ai-dynamo:mainfrom
AsadShahid04:fix/ipv6-support-7619

Conversation

@AsadShahid04

@AsadShahid04 AsadShahid04 commented Mar 25, 2026 •

Copy link
Copy Markdown
Contributor

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.

  • 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

Summary by CodeRabbit

  • Tests
    • Added test coverage for IPv6-only network configuration to enhance reliability and verification of IPv6 support.

@AsadShahid04
AsadShahid04 requested a review from a team March 25, 2026 09:33
@copy-pr-bot

copy-pr-bot Bot commented Mar 25, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@github-actions

Copy link
Copy Markdown
Contributor

👋 Hi AsadShahid04! Thank you for contributing to ai-dynamo/dynamo.

Just a reminder: The NVIDIA Test Github Validation CI runs an essential subset of the testing framework to quickly catch errors.Your PR reviewers may elect to test the changes comprehensively before approving your changes.

🚀

@github-actions github-actions Bot added test external-contribution Pull request is from an external contributor labels Mar 25, 2026
@coderabbitai

coderabbitai Bot commented Mar 25, 2026

Copy link
Copy Markdown
Contributor

Walkthrough

Added test coverage for IPv6-only network environments by introducing a test-only Ipv6OnlyResolver implementation and a new test case that validates TcpStreamServer correctly binds to IPv6 addresses when IPv4 is unavailable.

Changes

Cohort / File(s) Summary
IPv6-only network test coverage
lib/runtime/src/pipeline/network/tcp/server.rs
Added Ipv6OnlyResolver test resolver implementation that returns LocalIpAddressNotFound for IPv4 and a fixed IPv6 address for IPv6. Introduced test_tcp_stream_server_ipv6_only_network test to verify TcpStreamServer binds correctly to IPv6 addresses in IPv6-only environments.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Linked Issues check ⚠️ Warning The PR adds a test for IPv6-only scenarios but does not fix the root cause: the or_else logic only catches LocalIpAddressNotFound, not StrategyError from the netlink library. The PR should also update the error handling in tcp/server.rs and ip_resolver.rs to catch broader error types (not just LocalIpAddressNotFound) to trigger IPv6 fallback on StrategyError.
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: adding an IPv6-only network test case for the TCP server.
Description check ✅ Passed The description follows the template, includes a related issue reference, and clearly explains the changes and their purpose.
Out of Scope Changes check ✅ Passed All changes are within scope: the PR adds only a test implementation for IPv6-only scenarios without introducing unrelated modifications.

✏️ 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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between 14a6122 and 8651a24.

📒 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]>
@AsadShahid04
AsadShahid04 force-pushed the fix/ipv6-support-7619 branch 2 times, most recently from e7b4095 to 419842c Compare March 26, 2026 04:32
…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]>
@rmccorm4

rmccorm4 commented Apr 9, 2026

Copy link
Copy Markdown
Contributor

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.

@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

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.

@github-actions github-actions Bot added the Stale label Nov 4, 2026
@github-actions

Copy link
Copy Markdown
Contributor

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.

@github-actions github-actions Bot closed this Nov 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

external-contribution Pull request is from an external contributor size/M Stale test

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG]: Dynamo fails in IPv6-only environments — "ifa_prefixlen must be initialized"

2 participants