Skip to content

Commit

Permalink
[Xamarin.Android.Build.Tests] Retry MissingOrgApacheHttpClient. (#5717)
Browse files Browse the repository at this point in the history
The `MissingOrgApacheHttpClient` test seems to fail on a regular basis.
This is probably down to networking issues, so we should retry this
test a few times just in case.

Additionally, use `$(XamarinBuildDownloadDir)` to a local folder in the test:

https://github.com/xamarin/XamarinComponents/blob/4f5a57bd567f46f4b67622ab718b50485725463f/Util/Xamarin.Build.Download/source/Xamarin.Build.Download/Xamarin.Build.Download.targets#L9

This way if the test needs to retry, it starts with a fresh directory.
  • Loading branch information
dellis1972 authored Mar 11, 2021
1 parent a02084e commit afc0358
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3363,6 +3363,7 @@ public void foo()

//See: https://developer.android.com/about/versions/marshmallow/android-6.0-changes#behavior-apache-http-client
[Test]
[Retry (5)]
public void MissingOrgApacheHttpClient ([Values ("dx", "d8")] string dexTool)
{
AssertDexToolSupported (dexTool);
Expand All @@ -3372,8 +3373,12 @@ public void MissingOrgApacheHttpClient ([Values ("dx", "d8")] string dexTool)
proj.AndroidManifest = proj.AndroidManifest.Replace ("</application>",
"<uses-library android:name=\"org.apache.http.legacy\" android:required=\"false\" /></application>");
proj.SetProperty ("AndroidEnableMultiDex", "True");

proj.PackageReferences.Add (KnownPackages.Xamarin_GooglePlayServices_Maps);
using (var b = CreateApkBuilder (Path.Combine ("temp", TestName))) {
string downloaddir = Path.Combine (Root, b.ProjectDirectory, "Downloads");
Directory.CreateDirectory (downloaddir);
proj.SetProperty ("XamarinBuildDownloadDir", downloaddir);
Assert.IsTrue (b.Build (proj), "Build should have succeeded");
}
}
Expand Down

0 comments on commit afc0358

Please sign in to comment.