Skip to content

Commit 1047b55

Browse files
[tests] Ignore transient IO errors in on-device HTTP tests (#10962)
* Ignore transient SSL errors in on-device HTTP client handler tests * Scope IOException check to HttpRequestException inner exceptions Co-authored-by: Jonathan Peppers <jonathan.peppers@microsoft.com>
1 parent b61c3c3 commit 1047b55

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

tests/Mono.Android-Tests/Mono.Android-Tests/Xamarin.Android.Net/AndroidClientHandlerTests.cs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,20 @@ protected bool IgnoreIfConnectionFailed (AggregateException aex, out bool connec
128128

129129
bool IgnoreIfConnectionFailed (HttpRequestException hrex, out bool connectionFailed)
130130
{
131-
return IgnoreIfConnectionFailed (hrex?.InnerException as WebException, out connectionFailed);
131+
connectionFailed = false;
132+
if (hrex == null)
133+
return false;
134+
135+
if (IgnoreIfConnectionFailed (hrex.InnerException as WebException, out connectionFailed))
136+
return true;
137+
138+
if (hrex.InnerException is System.IO.IOException ioEx) {
139+
connectionFailed = true;
140+
Assert.Ignore ($"Ignoring transient IO error: {ioEx}");
141+
return true;
142+
}
143+
144+
return false;
132145
}
133146

134147
bool IgnoreIfConnectionFailed (WebException wex, out bool connectionFailed)
@@ -168,6 +181,7 @@ bool IgnoreIfSocketException (Exception ex, out bool connectionFailed)
168181
}
169182
return false;
170183
}
184+
171185
}
172186

173187
[Category ("AndroidClientHandler")]

0 commit comments

Comments
 (0)