-
Notifications
You must be signed in to change notification settings - Fork 5.1k
Harden CancelSendPingAsync tests #116588
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 CancelSendPingAsync tests #116588
Conversation
Tagging subscribers to this area: @dotnet/ncl |
This comment was marked as outdated.
This comment was marked as outdated.
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 separates the existing CancelSendPingAsync
test into two focused scenarios—hostname and IPAddress variants—and hardens the IPAddress test by pinging unreachable addresses with retry logic to reduce CI flakiness.
- Split
CancelSendPingAsync
intoCancelSendPingAsync_HostName
andCancelSendPingAsync_IPAddress
methods. - Updated the IPAddress test to iterate over multiple unreachable IPs and retry if the network immediately replies.
- Removed combined host/IP logic and streamlined cancellation calls.
Comments suppressed due to low confidence (1)
src/libraries/System.Net.Ping/tests/FunctionalTests/PingTest.cs:715
- [nitpick] The comment on the
OuterLoop
attribute refers to an "external host", but this test targets unreachable IPs. Updating the comment to reflect dependency on unreachable-address behavior would improve clarity.
[OuterLoop] // Depends on external host and assumption that successful ping takes long enough for cancellation to go through first
src/libraries/System.Net.Ping/tests/FunctionalTests/PingTest.cs
Outdated
Show resolved
Hide resolved
Co-authored-by: Copilot <[email protected]>
…onfirsov/runtime into harden-CancelSendPingAsync-1
This comment was marked as outdated.
This comment was marked as outdated.
/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 if CI passes, Thanks!
Outerloop failures are unrelated. |
Fixes #113831.
Separate
SendPingAsync(hostname)
andSendPingAsync(IPAddress)
test implementations:SendPingAsync(hostname)
: we didn't see issues with this variant in the CI. It effectively tests if the resolution ofwww.microsoft.com
is cancelled as part of theSendPingAsync
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 HardenPing_TimedOut_*
tests #116500, repeating the test with other hosts if it happens.