Skip to content
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

System.Net.Ping: Skip TimeoutIsRespected test if network is unreachable #58745

Merged
merged 1 commit into from
Sep 9, 2021

Conversation

akoeplinger
Copy link
Member

@akoeplinger akoeplinger commented Sep 7, 2021

The TestSettings.UnreachableAddress is using 192.0.2.0 (TEST-NET-1) which is documented in RFC5735 as a network to be used in docs/example code.
On the Android devices in Helix the upstream network is configured to not route this address which results in a Destination Net Unreachable response which causes the timeout argument to ping to be ignored and ping returns immediately.
Skip the test in these cases.

Example output from ping on the device:

1|sunfish:/ $ time ping -c 1 -W 2 -s 50 192.0.2.0
PING 192.0.2.0 (192.0.2.0) 50(78) bytes of data.
From 131.107.5.118: icmp_seq=1 Destination Net Unreachable

--- 192.0.2.0 ping statistics ---
1 packets transmitted, 0 received, +1 errors, 100% packet loss, time Oms

   0m00.03s real   0m00.00s user   0m00.00s system

The TestSettings.UnreachableAddress is using 192.0.2.0 which is documented in RFC5735 as a network to be used in docs/example code.
On the Android devices in Helix the upstream network is configured to not route this address which results in a "Destination Net Unreachable" response
which causes the timeout argument to ping to be ignored and ping returns immediately.
Skip the test in these cases.

Example output from ping on the device:

```
1|sunfish:/ $ time ping -c 1 -W 2 -s 50 192.0.2.0
PING 192.0.2.0 (192.0.2.0) 50(78) bytes of data.
From 131.107.5.118: icmp_seq=1 Destination Net Unreachable

--- 192.0.2.0 ping statistics ---
1 packets transmitted, 0 received, +1 errors, 100% packet loss, time Oms

   0m00.03s real   0m00.00s user   0m00.00s system
```
bool destinationNetUnreachable = false;
p.OutputDataReceived += delegate (object sendingProcess, DataReceivedEventArgs outputLine)
{
if (outputLine.Data?.Contains("Destination Net Unreachable", StringComparison.OrdinalIgnoreCase) == true)
Copy link
Member

Choose a reason for hiding this comment

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

Does this text get localized on any OSes?

Copy link
Member Author

Choose a reason for hiding this comment

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

On Windows it is, but this file is specific to Unix where I haven't seen this output being localized.

We also already rely on the English strings in ParseReturnedPacketSize and ParseNumPingsSent.

Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
if (outputLine.Data?.Contains("Destination Net Unreachable", StringComparison.OrdinalIgnoreCase) == true)
if (outputLine.Data?.Contains("Destination Net Unreachable", StringComparison.OrdinalIgnoreCase))

maybe we should have an analyzer for == true and != false

Copy link
Member Author

Choose a reason for hiding this comment

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

@danmoseley this doesn't work because of the null conditional operator so we need the explicit comparison.

@akoeplinger akoeplinger merged commit 84fb871 into dotnet:main Sep 9, 2021
@akoeplinger akoeplinger deleted the fix-android-ping branch September 9, 2021 11:40
akoeplinger added a commit to mdh1418/runtime that referenced this pull request Sep 9, 2021
…le (dotnet#58745)

The TestSettings.UnreachableAddress is using 192.0.2.0 which is documented in RFC5735 as a network to be used in docs/example code.
On the Android devices in Helix the upstream network is configured to not route this address which results in a "Destination Net Unreachable" response
which causes the timeout argument to ping to be ignored and ping returns immediately.
Skip the test in these cases.

Example output from ping on the device:

```
1|sunfish:/ $ time ping -c 1 -W 2 -s 50 192.0.2.0
PING 192.0.2.0 (192.0.2.0) 50(78) bytes of data.
From 131.107.5.118: icmp_seq=1 Destination Net Unreachable

--- 192.0.2.0 ping statistics ---
1 packets transmitted, 0 received, +1 errors, 100% packet loss, time Oms

   0m00.03s real   0m00.00s user   0m00.00s system
```

(cherry picked from commit 84fb871)
steveisok pushed a commit that referenced this pull request Sep 13, 2021
…t and test fixes for Android (#58841)

Manual backport of #57208, #58519, #58562, #58210, #57732, #58428, #58586, #58745, #57687 to release/6.0

Numerous test suites have been failing for iOS/tvOS/MacCatalyst consistently on CI without useful logs as to why. Moreover, some of these suites pass locally.

This PR looks to reduce the failures on CI by skipping the problematic suites
Skips test suites logged in #53624

ActiveIssues
#58440
#58418
#58367
#58584

Co-authored-by: Mitchell Hwang <mitchell.hwang@microsoft.com>
Co-authored-by: Alexander Köplinger <alex.koeplinger@outlook.com>
Co-authored-by: Jo Shields <directhex@apebox.org>
@karelz karelz added this to the 7.0.0 milestone Sep 22, 2021
@ghost ghost locked as resolved and limited conversation to collaborators Nov 3, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants