-
Notifications
You must be signed in to change notification settings - Fork 5k
Harden Ping_TimedOut_*
tests
#116500
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Harden Ping_TimedOut_*
tests
#116500
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR aims to improve the reliability of ping timeout tests by using multiple unreachable addresses so that intermittent network conditions (such as receiving a DestinationNetworkUnreachable response) don’t falsely mark the tests as failures.
- Introduces two additional unreachable IP addresses in TestSettings.
- Refactors the ping tests into a reusable core method that retries the ping if an unexpected ICMP response is received.
- Updates both synchronous and asynchronous test variants to leverage the new core method.
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
File | Description |
---|---|
src/libraries/System.Net.Ping/tests/FunctionalTests/TestSettings.cs | Added new unreachable addresses to cover varied ICMP responses. |
src/libraries/System.Net.Ping/tests/FunctionalTests/PingTest.cs | Refactored tests into a common core method and updated test methods accordingly. |
Tagging subscribers to this area: @dotnet/ncl |
/azp run runtime-libraries-coreclr outerloop |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run runtime-libraries-coreclr outerloop |
Azure Pipelines successfully started running 1 pipeline(s). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks @antonfirsov
/azp run runtime-libraries-coreclr outerloop |
Azure Pipelines successfully started running 1 pipeline(s). |
/ba-g CI failures are unrelated |
The tests passed in 3 consecutive outerloop runs, merging. |
/backport to release/9.0-staging |
/backport to release/8.0-staging |
Started backporting to release/9.0-staging: https://github.com/dotnet/runtime/actions/runs/15637351117 |
Started backporting to release/8.0-staging: https://github.com/dotnet/runtime/actions/runs/15637353573 |
Fixes #113831. Separate `SendPingAsync(hostname)` and `SendPingAsync(IPAddress)` test implementations: - `SendPingAsync(hostname)`: we didn't see issues with this variant in the CI. It effectively tests if the resolution of `www.microsoft.com` is cancelled as part of the `SendPingAsync` call. Keep the existing logic in a separate method. - `SendPingAsync(IPAddress)`: occasionally, pinging the valid IP likely resulted in replies before the cancellation could kick in on Helix Mac machines. Instead, let's ping an unreachable IP to avoid this. Since that can also sometimes result to an ICMP reply instead of a timeout, use the same trick as in #116500, repeating the test with other hosts if it happens.
Fixes #115358.
Depending on the network configuration, we can get an ICMP with
Type=Destination Unreachable, Code=Network Unreachable
from middlewares when pinging an "unreachable" IP. In #115358 we see this happening on Helix Mac machines, but I was able to reproduce it on an office LAN-connected Windows PC too.This PR attempts to fix address this problem by repeating the ping tests on other "types" of unreachable hosts until we actually catch a timeout. (We could instead just skip the test on the first
DestinationNetworkUnreachable
, but then we would loose some functional coverage.)Marking as draft until we get a few successful outerloop runs.