Skip to content

Make GoogleV2 dependency test deterministic and offline - #12580

Open
jonathanpeppers wants to merge 5 commits into
mainfrom
jonathanpeppers-make-googlev2-test-offline
Open

Make GoogleV2 dependency test deterministic and offline#12580
jonathanpeppers wants to merge 5 commits into
mainfrom
jonathanpeppers-make-googlev2-test-offline

Conversation

@jonathanpeppers

@jonathanpeppers jonathanpeppers commented Aug 28, 2026

Copy link
Copy Markdown
Member

Summary

  • move GoogleV2 coverage entirely into the test assembly using the existing AndroidSDKInstaller constructor and IHelpers.DownloadToString() injection seam
  • generate minimal synthetic repository/add-ons metadata and ZIP archives in memory, then materialize archives locally for checksum validation and installation
  • restore shipped installer behavior unchanged; no product code or MSBuild test hooks remain
  • keep the Xamarin manifest case as the real download/install path and subsequent application-build coverage

S360 / CFS motivation

S360 [SFI-ES4.2.4] Network Isolation reports recurring DefaultDeny traffic from the Linux MSBuild 2 and Windows MSBuild shards. The GoogleV2 case previously loaded repository2-3.xml from dl-ssl.google.com, followed repository artifacts to dl.google.com, and could trigger JDK download traffic.

This removes those GoogleV2/JDK egress paths without suppressing telemetry, adding a network exception, mirroring Google's SDK, uploading Google binaries, or dropping GoogleV2 coverage. S360 closure will remain delayed by its seven-day telemetry window.

Fixture design and preserved coverage

The GoogleV2 case now uses non-routable https://googlev2-fixture.test/ identities. A test IHelpers implementation serves only exact registered metadata URIs and throws for anything else. Archive URIs are likewise exact-matched to generated bytes and written to local temporary files; there is no network fallback.

Coverage includes:

  • Google repository XML and add-ons-list parsing
  • stable platform-tools version selection
  • direct and transitive dependency resolution
  • SHA-256 validation and safe ZIP extraction
  • generated package.xml files and expected SDK layout
  • parsed license data and local synthetic sdkmanager execution
  • reuse of the configured local JDK, with no JDK installation
  • exact fixture-access tracking

The Xamarin parameter continues to exercise the InstallAndroidDependencies MSBuild task, real internal artifact installation, and the successful subsequent project build.

Validation

  • dotnet-local.cmd build src\Xamarin.Android.Build.Tasks\Tests\Xamarin.Android.Build.Tests\Xamarin.Android.Build.Tests.csproj -nodeReuse:false -v:minimal
  • focused Debug GoogleV2 run: 1 passed, 1 unsupported NativeAOT configuration skipped
  • Release test-project build was attempted but this local checkout lacks bin\BuildRelease\net10.0\Xamarin.Android.Tools.BootstrapTasks.dll and Release JDK setup; CI provides those prepared prerequisites
  • inspected the public dotnet-android Azure DevOps pipeline with az pipelines; internal DevDiv build IDs 11410 and 12278 are not visible in dnceng-public

Use deterministic loopback repository metadata and synthetic archives for GoogleV2 coverage while retaining the Xamarin feed installation path.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI lite review requested due to automatic review settings August 28, 2026 17:44

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.

Pull request overview

This PR removes live Google repository network dependencies from the GoogleV2 variant of InstallAndroidDependenciesTest by introducing a deterministic loopback HTTP fixture (synthetic repository/add-ons XML + minimal ZIP archives), and adds a private MSBuild seam to inject the Google add-ons list source while keeping production defaults unchanged.

Changes:

  • Adds a private _AndroidGoogleAddonsListSource → task parameter plumbing so tests can inject a deterministic add-ons list URL.
  • Updates InstallAndroidDependenciesTest to use a local loopback server fixture for GoogleV2 (and reuses the configured local JDK), eliminating external egress.
  • Relaxes Release manifest download restrictions to allow loopback http:// (while still rejecting non-loopback HTTP).

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
src/Xamarin.Installer.Build.Tasks/Xamarin.Installer.Common.targets Passes a private add-ons list source property into the installer MSBuild task.
src/Xamarin.Installer.Build.Tasks/Tasks/InstallAndroidDependencies.cs Adds task parameter handling and forwards the optional Google add-ons list URL into AndroidSDKInstaller.
src/Xamarin.Installer.AndroidSDK/Xamarin.Installer.AndroidSDK/Common/Helper.cs Permits loopback HTTP for manifest downloads in Release builds to support the offline fixture.
src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/AndroidDependenciesTests.cs Reworks GoogleV2 test to use an offline loopback fixture server and validates installation + request set.

Comment thread src/Xamarin.Installer.Build.Tasks/Tasks/InstallAndroidDependencies.cs Outdated
Reuse the existing manifest base for loopback add-ons metadata and remove the extra MSBuild task property. Keep the fixture server small and bounded.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 2ba9e613-f7b5-4a9d-b647-f49c3a790f78
Avoid duplicating the versioned add-ons list filename when resolving loopback fixtures.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 2ba9e613-f7b5-4a9d-b647-f49c3a790f78
Keep all fixture injection in the test assembly and restore shipped installer behavior unchanged.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 2ba9e613-f7b5-4a9d-b647-f49c3a790f78
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 2ba9e613-f7b5-4a9d-b647-f49c3a790f78
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.

2 participants