Skip to content

[tests] Report InstallAndroidDependenciesTest network outages as inconclusive - #13701

Draft
simonrozsival wants to merge 8 commits into
mainfrom
simonrozsival-android-deps-test-flakiness
Draft

simonrozsival wants to merge 8 commits into
mainfrom
simonrozsival-android-deps-test-flakiness

Conversation

@simonrozsival

@simonrozsival simonrozsival commented Nov 21, 2026 •

Copy link
Copy Markdown
Member

Context: #13644

InstallAndroidDependenciesTest sometimes failed all three install attempts because downloads from aka.ms failed, e.g. XAIAD7024: System.Net.Http.HttpIOException: The response ended prematurely or XAIAD7000: System.Net.Http.HttpRequestException: nodename nor servname provided, or not known (aka.ms:443).

The test still installs the Android SDK, the JDK and (for NativeAOT) the NDK from scratch, then builds the app with them. Changes:

  • Each install attempt writes its own install-deps-N.log, so earlier failures keep their diagnostics.
  • If all three attempts fail with an HTTP transport error from the installer (HttpRequestException/HttpIOException), the test is reported as inconclusive and lists the error from each attempt. HTTP status code errors (e.g. 404), timeouts, signature or extraction errors, missing packages and build failures still fail the test.
  • AndroidSdkDirectory and JavaSdkDirectory are passed explicitly, so the build cannot fall back to a shared SDK/JDK if the project builder removes the temporary directories.

Validation on macOS arm64:

  • Compiled Xamarin.Android.Build.Tests.csproj (-t:Compile into a temporary intermediate directory): 0 warnings, 0 errors.
  • Ran the failure classifier against saved logs: a real DNS failure install-deps.log and the CI HttpIOException truncation line are classified as network failures; a real Build Timed Out! log and an HTTP 404 line are not.
  • The full InstallAndroidDependenciesTest has not yet been run with this revision against the local SDK.

simonrozsival and others added 7 commits November 21, 2026 00:24
Context: #13644

InstallAndroidDependenciesTest failed when the JDK download from aka.ms
ended early ("The response ended prematurely"). This failure happened in all
three of the test's install attempts. InstallAndroidDependencies downloaded each archive in a
single request and did not check the length.

DownloadAsync now checks that the response has the expected length. It
retries connection failures, truncated responses, and transient HTTP status codes
(408, 429, 5xx) up to 4 times with exponential backoff. Each retry resumes with an
HTTP Range request when the server supports it; download.visualstudio.microsoft.com
does. The existing OpenJDK signature and Android CLI SHA-256 checks still verify
the result.

Co-authored-by: Copilot App <[email protected]>
Context: #13644

InstallAndroidDependenciesTest was flaky because the ~200 MB JDK download from
aka.ms sometimes ended early ("The response ended prematurely"). It failed in all
three of the test's install attempts.

The test now uses the JDK that CI already provides, so the task takes its
"already installed" path and the test asserts that it did. The live test still
installs the Android CLI and SDK packages from scratch. The new deterministic
InstallJdkExtractsArchive test covers JDK installation by extracting a local
fixture archive. OpenJdkSignatureTests and UnknownJdkVersionIsNotValid already cover
signature verification and URL validation without network access.

Co-authored-by: Copilot App <[email protected]>
Context: #13644

The live dependency-install test must not replace a shared provisioned JDK if it is missing or too old. Pass the resolved JavaSdkDirectory explicitly, require that directory to exist, and set AndroidInstallJavaDependencies=false for both installation and the subsequent build. Assert the task skips Java installation, and correct the stale comment about downloading the JDK.

Validation: the installer project builds with zero warnings/errors. An isolated MSBuild invocation using the actual installer targets, with TEST_ANDROID_JDK_PATH unset and an older fixture JDK at a path containing spaces, passes the exact JavaSdkPath, skips Java installation despite a requested version of 999.0, and leaves the fixture unchanged. Full SDK validation remains queued by the coordinator.

Co-authored-by: Copilot App <[email protected]>
The project builder can delete the temporary SDK directory while saving a new project. Pass AndroidSdkDirectory explicitly so dependency installation cannot fall back to a shared SDK when that directory no longer exists.

Co-authored-by: Copilot App <[email protected]>
Context: #13644

The dependency integration test requires a provisioned JDK to avoid downloading it from the network. Mark the test inconclusive when that prerequisite is absent rather than failing the test.

Co-authored-by: Copilot App <[email protected]>
Keep the dependency-install change limited to the existing tests. The live test no longer verifies JDK extraction or downloading.

Co-authored-by: Copilot App <[email protected]>
Copilot AI balanced review requested due to automatic review settings November 21, 2026 00:05

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.

🟢 Approval recommended

No active review issues are reported for the changes that reuse the provisioned JDK and isolate SDK installation.

No open issues 🎉

What changed in this PR

Reduces JDK-download-related flakiness in the Android dependency integration test tracked by #13644, while retaining Android SDK and NativeAOT NDK installation coverage.

Changes:

  • Reuses the provisioned JDK and marks the test inconclusive when its directory is missing.
  • Disables JDK installation and checks that the installer reports skipping it.
  • Explicitly passes SDK/JDK paths to installation and build steps, limiting cleanup to the temporary SDK directory.
File Description
src/​Xamarin.Android.Build.Tasks/​Tests/​Xamarin.Android.Build.Tests/​AndroidDependenciesTests.cs Reuses the shared JDK without reinstalling it and keeps SDK installation isolated to the test directory.

Review effort: Balanced

Context: #13644

Using the provisioned JDK removed the only end-to-end coverage of downloading, verifying and installing a JDK. Restore the fresh SDK/JDK install instead.

Each install attempt now writes its own install-deps-N.log so earlier failures keep their diagnostics. If all three attempts fail with an HTTP transport error from the installer (HttpRequestException or HttpIOException, such as a DNS failure or truncated download), the test is inconclusive. HTTP status code failures, timeouts, verification or extraction errors, missing packages and the subsequent build still fail the test.

Keep passing AndroidSdkDirectory and JavaSdkDirectory explicitly so the build cannot fall back to a shared SDK/JDK.

Co-authored-by: Copilot App <[email protected]>
@simonrozsival simonrozsival changed the title [tests] Avoid downloading the JDK in dependency tests [tests] Report InstallAndroidDependenciesTest network outages as inconclusive Nov 22, 2026

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants