Skip to content

[tests] Mark ProxyTest as Inconclusive on network failure#11288

Open
jonathanpeppers wants to merge 2 commits intomainfrom
jonathanpeppers/inconclusive-network-errors
Open

[tests] Mark ProxyTest as Inconclusive on network failure#11288
jonathanpeppers wants to merge 2 commits intomainfrom
jonathanpeppers/inconclusive-network-errors

Conversation

@jonathanpeppers
Copy link
Copy Markdown
Member

Summary

Mark ProxyTest.QuoteInvalidQuoteUrlsShouldWork as Assert.Inconclusive() on network failure instead of failing the test. This matches the existing pattern used in SslTest and other network-dependent tests.

Problem

The test fails when DNS resolution is unavailable on the test machine:

System.Net.WebException : hostname nor servname provided, or not known (www.msftconnecttest.com:80)
----> System.Net.Http.HttpRequestException : hostname nor servname provided, or not known (www.msftconnecttest.com:80)
----> System.Net.Sockets.SocketException : hostname nor servname provided, or not known

 at System.Net.HttpWebRequest.GetResponse()
 at System.NetTests.ProxyTest.QuoteInvalidQuoteUrlsShouldWork()
 at System.Reflection.DynamicInvokeInfo.Invoke(Object, IntPtr, Object[], BinderBundle, Boolean)
--HttpRequestException
 at System.Net.Http.HttpConnectionPool.<ConnectToTcpHostAsync>d__54.MoveNext()
--- End of stack trace from previous location ---
 at System.Net.Http.HttpConnectionPool.<ConnectAsync>d__53.MoveNext()
--- End of stack trace from previous location ---
 at System.Net.Http.HttpConnectionPool.<CreateHttp11ConnectionAsync>d__82.MoveNext()
--- End of stack trace from previous location ---
 at System.Net.Http.HttpConnectionPool.<InjectNewHttp11ConnectionAsync>d__81.MoveNext()
--- End of stack trace from previous location ---
 at System.Threading.Tasks.TaskCompletionSourceWithCancellation`1.WaitWithCancellation(CancellationToken)
 at System.Net.Http.HttpConnectionPool.<SendWithVersionDetectionAndRetryAsync>d__52.MoveNext()
--- End of stack trace from previous location ---
 at System.Net.Http.RedirectHandler.<SendAsync>d__4.MoveNext()
--- End of stack trace from previous location ---
 at System.Net.Http.HttpMessageHandlerStage.Send(HttpRequestMessage, CancellationToken)
 at System.Net.Http.SocketsHttpHandler.Send(HttpRequestMessage, CancellationToken)
 at System.Net.Http.HttpClient.Send(HttpRequestMessage, HttpCompletionOption, CancellationToken)
 at System.Net.HttpWebRequest.SendRequest(Boolean, HttpContent)
 at System.Net.HttpWebRequest.<HandleResponse>d__201.MoveNext()
--- End of stack trace from previous location ---
 at System.Net.HttpWebRequest.GetResponse()
--SocketException
 at System.Net.Dns.GetHostEntryOrAddressesCore(String, Boolean, AddressFamily, Nullable`1)
 at System.Net.Dns.GetHostAddresses(String, AddressFamily)
 at System.Net.HttpWebRequest.<>c__DisplayClass224_0.<<CreateHttpClient>b__1>d.MoveNext()
--- End of stack trace from previous location ---
 at System.Net.Http.HttpConnectionPool.<ConnectToTcpHostAsync>d__54.MoveNext()

Fix

Wrap the test body in a try/catch that catches WebException with ConnectFailure, NameResolutionFailure, or Timeout status and calls Assert.Inconclusive().

…work failure

Catch WebException for ConnectFailure, NameResolutionFailure, and
Timeout and call Assert.Inconclusive() instead of failing. This
matches the pattern used in SslTest and other network-dependent tests.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings May 5, 2026 13:27
Copy link
Copy Markdown
Contributor

Copilot AI left a 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 adjusts a flaky Mono.Android-Tests network test so transient connectivity problems on the test machine no longer fail the suite outright. It targets System.Net test stability rather than product/runtime behavior.

Changes:

  • Wraps ProxyTest.QuoteInvalidQuoteUrlsShouldWork() in a try/catch.
  • Treats ConnectFailure, NameResolutionFailure, and Timeout WebExceptions as non-failures.
  • Reports those transient failures via an NUnit non-passing result instead of a hard test failure.

Comment thread tests/Mono.Android-Tests/Mono.Android-Tests/System.Net/ProxyTest.cs Outdated
…ttern

All other network failure handlers in this test suite use Assert.Ignore.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@jonathanpeppers jonathanpeppers added the ready-to-review This PR is ready to review/merge, I think any CI failures are just flaky (ignorable). label May 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-to-review This PR is ready to review/merge, I think any CI failures are just flaky (ignorable).

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants