Skip to content

[release/10.0.1xx] [tests] Use local servers for networking tests - #13401

Open
jonathanpeppers wants to merge 1 commit into
release/10.0.1xxfrom
jonathanpeppers-backport-local-networking-tests
Open

jonathanpeppers wants to merge 1 commit into
release/10.0.1xxfrom
jonathanpeppers-backport-local-networking-tests

Conversation

@jonathanpeppers

Copy link
Copy Markdown
Member

Summary

Manual backport of #12022 (bef2665) to release/10.0.1xx after the automatic backport failed.

  • Replace external redirect/decompression endpoints and badssl certificate cases with local loopback servers.
  • Preserve .NET 10's AndroidClientHandler fixture and inherited redirect coverage in AndroidClientHandlerTests.cs.
  • Keep release-specific project entries, include the new helper, and use C# 8 for the netstandard2.0 LinkDesc regression library.
  • Retain the assertion that HTTPS redirects invoke certificate validation twice, accepting local self-signed certificates explicitly rather than ignoring HTTP 403 responses.

This branch contains exactly one commit on top of release/10.0.1xx.

Validation

  • Compiled both complete handler fixtures and the local-server helper against .NET 10 Android reference assemblies (Microsoft.Android.Ref.36 36.1.118).
  • Compiled the LinkDesc HttpClient regression and helper for netstandard2.0 with C# 8.
  • Passed host-side loopback checks for GET/POST 302 and 308 redirects, gzip/brotli decompression, POST payload handling, HTTPS redirects with exactly two certificate callbacks, certificate hostname mismatch reporting, and trusted-certificate hostname rejection. The harness targeted .NET 10 but executed on the installed .NET 11 runtime via major-version roll-forward.
  • Full Android build/device execution remains unverified: the worktree has no prepared local SDK, and no Android device is connected.

Backport to release/10.0.1xx, retaining AndroidClientHandler and its shared
test base in AndroidClientHandlerTests.cs. Keep the release-specific
project entries and netstandard2.0 LinkDesc test library configuration.

Replace httpbin.org redirect/decompression coverage and badssl.com
certificate cases with local loopback servers. Preserve the two TLS
validation callbacks during redirects and use the local POST endpoint
for the LinkDesc HttpClient regression.

(cherry picked from commit bef2665)

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings November 5, 2026 11:30

Copilot AI 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.

🔵 Needs a closer look

The Android TLS, hostname-validation, and SslStream changes require .NET 10 Android device validation, which host-side .NET 11 checks do not establish.

No open issues 🎉

What changed in this PR

Backports local networking test servers to release/10.0.1xx, reducing external-service dependencies while preserving .NET 10 handler coverage.

Changes:

  • Replace external redirect, decompression, and invalid-certificate endpoints with loopback HTTP/HTTPS servers.
  • Adapt the LinkDesc regression to a local POST endpoint, with C# 8 and loopback cleartext configuration.
  • Preserve inherited AndroidClientHandler redirect tests and the assertion that HTTPS redirects trigger two certificate-validation callbacks.

Reported compilation and host-side checks passed; full Android build and device execution remain unverified.

File Description
tests/​MSBuildDeviceIntegration/​Tests/​InstallAndRunTests.cs Include the server helper, enable C# 8, and configure loopback cleartext access.
tests/​MSBuildDeviceIntegration/​Resources/​LinkDescTest/​HttpClientTest.cs Post to the local server and dispose request resources.
tests/​Mono.Android-Tests/​Mono.Android-Tests/​Xamarin.Android.Net/​LocalTestServers.cs Add loopback servers for redirects, compression, POST handling, and TLS certificates.
tests/​Mono.Android-Tests/​Mono.Android-Tests/​Xamarin.Android.Net/​AndroidMessageHandlerTests.cs Move decompression, certificate, and redirect tests to local endpoints.
tests/​Mono.Android-Tests/​Mono.Android-Tests/​Xamarin.Android.Net/​AndroidClientHandlerTests.cs Use local endpoints for inherited GET and POST redirect coverage.
tests/​Mono.Android-Tests/​Mono.Android-Tests/​System.Net/​SslTest.cs Remove httpbin from the external HTTPS smoke-test URLs.
tests/​Mono.Android-Tests/​Mono.Android-Tests/​Mono.Android.NET-Tests.csproj Compile the new local-server helper.

Review effort: Balanced

@jonathanpeppers

Copy link
Copy Markdown
Member Author

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
1 pipeline(s) were filtered out due to trigger conditions.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants