Skip to content

Commit 5ca3ae2

Browse files
amcaseycaptainsafia
authored andcommitted
Add output and retries to AddressRegistrationTests (#57903)
They're among our flakiest kestrel tests and they're already being retried on mac. Given that the error doesn't seem to be about kestrel's behavior, a retry seems reasonable. Part of #27377
1 parent 1d2c6ee commit 5ca3ae2

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/Testing/src/HttpClientSlim.cs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -108,11 +108,7 @@ private static async Task<string> ReadResponse(Stream stream)
108108

109109
private static async Task<string> RetryRequest(Func<Task<string>> retryBlock)
110110
{
111-
var retryCount = 1;
112-
if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
113-
{
114-
retryCount = 3;
115-
}
111+
var retryCount = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? 1 : 3;
116112

117113
for (var retry = 0; retry < retryCount; retry++)
118114
{
@@ -190,7 +186,12 @@ public static async Task<Socket> GetSocket(Uri requestUri)
190186

191187
if (socket == null)
192188
{
189+
#if NETCOREAPP
190+
// Include the host and port explicitly in case there's a parsing issue
191+
throw new SocketException((int)socketArgs.SocketError, $"Failed to connect to server {requestUri.Host} on port {requestUri.Port}");
192+
#else
193193
throw new SocketException((int)socketArgs.SocketError);
194+
#endif
194195
}
195196
else
196197
{

0 commit comments

Comments
 (0)