Bring up to 0.1.13 conformance (#1254)
This commit is contained in:
parent
9c1538fd98
commit
27b5eb8031
1 changed files with 1249 additions and 78 deletions
|
|
@ -470,11 +470,23 @@ public class StreamableHttpServerConformanceTests(ITestOutputHelper outputHelper
|
|||
await CallInitializeAndValidateAsync();
|
||||
await CallEchoAndValidateAsync();
|
||||
|
||||
// Add 5 seconds to idle timeout to account for the interval of the PeriodicTimer.
|
||||
fakeTimeProvider.Advance(TimeSpan.FromHours(2) + TimeSpan.FromSeconds(5));
|
||||
// The background IdleTrackingBackgroundService prunes sessions asynchronously after
|
||||
// the PeriodicTimer (5s interval) tick fires. We advance past the 2-hour idle timeout
|
||||
// then poll until the session returns NotFound. Each HTTP POST also refreshes the
|
||||
// session's LastActivityTicks via AcquireReferenceAsync, so we must re-advance time
|
||||
// each iteration to ensure the session appears idle again for the next prune pass.
|
||||
var deadline = DateTime.UtcNow + TestConstants.DefaultTimeout;
|
||||
HttpStatusCode statusCode;
|
||||
do
|
||||
{
|
||||
fakeTimeProvider.Advance(TimeSpan.FromHours(2) + TimeSpan.FromSeconds(5));
|
||||
await Task.Delay(100, TestContext.Current.CancellationToken);
|
||||
using var response = await HttpClient.PostAsync("", JsonContent(EchoRequest), TestContext.Current.CancellationToken);
|
||||
statusCode = response.StatusCode;
|
||||
}
|
||||
while (statusCode != HttpStatusCode.NotFound && DateTime.UtcNow < deadline);
|
||||
|
||||
using var response = await HttpClient.PostAsync("", JsonContent(EchoRequest), TestContext.Current.CancellationToken);
|
||||
Assert.Equal(HttpStatusCode.NotFound, response.StatusCode);
|
||||
Assert.Equal(HttpStatusCode.NotFound, statusCode);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
|
|||
Loading…
Reference in a new issue