-
Notifications
You must be signed in to change notification settings - Fork 40
Add a timeout for draining requests on shutdown #300
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -68,7 +68,7 @@ public async Task Server_EchoHelloWorld_Success() | |
} | ||
|
||
[ConditionalFact] | ||
public async Task Server_ShutdownDurringRequest_Success() | ||
public async Task Server_ShutdownDuringRequest_Success() | ||
{ | ||
Task<string> responseTask; | ||
ManualResetEvent received = new ManualResetEvent(false); | ||
|
@@ -87,6 +87,30 @@ public async Task Server_ShutdownDurringRequest_Success() | |
Assert.Equal("Hello World", response); | ||
} | ||
|
||
[ConditionalFact] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unrelated to the change itself, but these are conditional upon nothing. Change to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
public async Task Server_ShutdownDuringLongRunningRequest_TimesOut() | ||
{ | ||
Task<string> responseTask; | ||
var received = new ManualResetEvent(false); | ||
bool? shutdown = null; | ||
var waitForShutdown = new ManualResetEvent(false); | ||
string address; | ||
using (Utilities.CreateHttpServer(out address, httpContext => | ||
{ | ||
received.Set(); | ||
shutdown = waitForShutdown.WaitOne(TimeSpan.FromSeconds(15)); | ||
httpContext.Response.ContentLength = 11; | ||
return httpContext.Response.WriteAsync("Hello World"); | ||
})) | ||
{ | ||
responseTask = SendRequestAsync(address); | ||
Assert.True(received.WaitOne(TimeSpan.FromSeconds(10))); | ||
} | ||
Assert.False(shutdown.HasValue); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Check the logs written and make sure there's one request outstanding? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Logs? eww There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. redundant. I know there's an outstanding request because of |
||
waitForShutdown.Set(); | ||
await Assert.ThrowsAsync<HttpRequestException>(async () => await responseTask); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are there any specific things you can check in the exception to make sure it failed for the right reason? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not consistently across net451 and core. |
||
} | ||
|
||
[ConditionalFact] | ||
public void Server_AppException_ClientReset() | ||
{ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the default info should be in
<remarks>
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remarks looks like it's for extended discussion. summary is for IntelliSense. The comment is short enough we don't need to split it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why does Kestrel use remarks so much?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good.