Skip to content
This repository was archived by the owner on Mar 19, 2019. It is now read-only.

Commit 0ce85e2

Browse files
committed
#263 Add Caching_SetTtlAndStatusCode_Cached test diagnostics
1 parent 4e8872b commit 0ce85e2

File tree

1 file changed

+18
-3
lines changed

1 file changed

+18
-3
lines changed

test/Microsoft.AspNetCore.Server.HttpSys.FunctionalTests/Listener/ResponseCachingTests.cs

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -560,13 +560,28 @@ public async Task Caching_SetTtlAndStatusCode_Cached()
560560
context.Response.CacheTtl = TimeSpan.FromSeconds(10);
561561
context.Dispose();
562562

563-
var response = await responseTask;
563+
HttpResponseMessage response;
564+
try
565+
{
566+
response = await responseTask;
567+
}
568+
catch (Exception ex)
569+
{
570+
throw new Exception($"Failed to get first response for {status}", ex);
571+
}
564572
Assert.Equal(status, (int)response.StatusCode);
565573
Assert.Equal(status.ToString(), response.Headers.GetValues("x-request-count").FirstOrDefault());
566574
Assert.Equal(new byte[0], await response.Content.ReadAsByteArrayAsync());
567575

568576
// Send a second request and make sure we get the same response (without listening for one on the server).
569-
response = await SendRequestAsync(address + status);
577+
try
578+
{
579+
response = await SendRequestAsync(address + status);
580+
}
581+
catch (Exception ex)
582+
{
583+
throw new Exception($"Failed to get second response for {status}", ex);
584+
}
570585
Assert.Equal(status, (int)response.StatusCode);
571586
Assert.Equal(status.ToString(), response.Headers.GetValues("x-request-count").FirstOrDefault());
572587
Assert.Equal(new byte[0], await response.Content.ReadAsByteArrayAsync());
@@ -1137,7 +1152,7 @@ private async Task<HttpResponseMessage> SendRequestAsync(string uri, string meth
11371152
{
11381153
using (var handler = new HttpClientHandler() { AllowAutoRedirect = false })
11391154
{
1140-
using (var client = new HttpClient(handler) { Timeout = TimeSpan.FromSeconds(5) })
1155+
using (var client = new HttpClient(handler) { Timeout = Utilities.DefaultTimeout })
11411156
{
11421157
var request = new HttpRequestMessage(new HttpMethod(method), uri);
11431158
if (!string.IsNullOrEmpty(extraHeader))

0 commit comments

Comments
 (0)