Update some tests to be flaky rather than skipped (#8666)

This commit is contained in:
Justin Kotalik 2019-03-20 08:59:43 -07:00 committed by GitHub
parent 9db249e30a
commit 2d145682ce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 75 additions and 18 deletions

View File

@ -212,15 +212,22 @@ namespace Microsoft.AspNetCore.Server.IIS.FunctionalTests
await AssertRunning(deploymentResult);
}
[ConditionalTheory(Skip = "https://github.com/aspnet/AspNetCore/issues/7075")]
[ConditionalTheory]
[InlineData(HostingModel.InProcess)]
[InlineData(HostingModel.OutOfProcess)]
[Flaky("https://github.com/aspnet/AspNetCore/issues/7075")]
public async Task AppOfflineAddedAndRemovedStress(HostingModel hostingModel)
{
var deploymentResult = await AssertStarts(hostingModel);
var load = Helpers.StressLoad(deploymentResult.HttpClient, "/HelloWorld", response => {
var statusCode = (int)response.StatusCode;
// Test failure involves the stress load receiving a 400 Bad Request.
// We think it is due to IIS returning the 400 itself, but need to confirm the hypothesis.
if (statusCode == 400)
{
Logger.LogError($"Status code was a bad request. Content: {response.Content.ReadAsStringAsync().GetAwaiter().GetResult()}");
}
Assert.True(statusCode == 200 || statusCode == 503, "Status code was " + statusCode);
});

View File

@ -78,9 +78,10 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
EventLogHelpers.VerifyEventLogEvent(deploymentResult, EventLogHelpers.CouldNotFindHandler(), Logger);
}
[ConditionalTheory(Skip = "https://github.com/aspnet/AspNetCore-Internal/issues/1794")]
[ConditionalTheory]
[InlineData(HostingModel.InProcess)]
[InlineData(HostingModel.OutOfProcess)]
[Flaky("https://github.com/aspnet/AspNetCore-Internal/issues/1794")]
public async Task ConfigurationTouchedStress(HostingModel hostingModel)
{
var deploymentResult = await DeployAsync(Fixture.GetBaseDeploymentParameters(hostingModel));

View File

@ -318,24 +318,31 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
}
}
[ConditionalFact(Skip = "https://github.com/aspnet/AspNetCore-Internal/issues/1772")]
[ConditionalFact]
[Flaky("https://github.com/aspnet/AspNetCore-Internal/issues/1772")]
public async Task StartupTimeoutIsApplied()
{
var deploymentParameters = Fixture.GetBaseDeploymentParameters(Fixture.InProcessTestSite);
deploymentParameters.TransformArguments((a, _) => $"{a} Hang");
deploymentParameters.WebConfigActionList.Add(
WebConfigHelpers.AddOrModifyAspNetCoreSection("startupTimeLimit", "1"));
// From what I can tell, this failure is due to ungraceful shutdown.
// The error could be the same as https://github.com/dotnet/core-setup/issues/4646
// But can't be certain without another repro.
using (AppVerifier.Disable(DeployerSelector.ServerType, 0x300))
{
var deploymentParameters = Fixture.GetBaseDeploymentParameters(Fixture.InProcessTestSite);
deploymentParameters.TransformArguments((a, _) => $"{a} Hang");
deploymentParameters.WebConfigActionList.Add(
WebConfigHelpers.AddOrModifyAspNetCoreSection("startupTimeLimit", "1"));
var deploymentResult = await DeployAsync(deploymentParameters);
var deploymentResult = await DeployAsync(deploymentParameters);
var response = await deploymentResult.HttpClient.GetAsync("/");
Assert.Equal(HttpStatusCode.InternalServerError, response.StatusCode);
var response = await deploymentResult.HttpClient.GetAsync("/");
Assert.Equal(HttpStatusCode.InternalServerError, response.StatusCode);
StopServer();
StopServer();
EventLogHelpers.VerifyEventLogEvents(deploymentResult,
EventLogHelpers.InProcessFailedToStart(deploymentResult, "Managed server didn't initialize after 1000 ms.")
);
EventLogHelpers.VerifyEventLogEvents(deploymentResult,
EventLogHelpers.InProcessFailedToStart(deploymentResult, "Managed server didn't initialize after 1000 ms.")
);
}
}
[ConditionalFact]

View File

@ -50,7 +50,8 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
AssertConnectionDisconnectLog();
}
[ConditionalFact(Skip = "https://github.com/aspnet/AspNetCore-Internal/issues/1831")]
[ConditionalFact]
[Flaky("https://github.com/aspnet/AspNetCore-Internal/issues/1831")]
public async Task WritesCancelledWhenUsingAbortedToken()
{
var requestStartedCompletionSource = CreateTaskCompletionSource();
@ -172,7 +173,8 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
}
}
[ConditionalFact(Skip = "https://github.com/aspnet/AspNetCore-Internal/issues/1831")]
[ConditionalFact]
[Flaky("https://github.com/aspnet/AspNetCore-Internal/issues/1831")]
public async Task ReaderThrowsCancelledException()
{
var requestStartedCompletionSource = CreateTaskCompletionSource();
@ -217,7 +219,8 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
}
}
[ConditionalFact(Skip = "https://github.com/aspnet/AspNetCore-Internal/issues/1817")]
[ConditionalFact]
[Flaky("https://github.com/aspnet/AspNetCore-Internal/issues/1817")]
public async Task ReaderThrowsResetExceptionOnInvalidBody()
{
var requestStartedCompletionSource = CreateTaskCompletionSource();
@ -237,7 +240,6 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
{
exception = e;
}
requestCompletedCompletionSource.SetResult(true);
}, LoggerFactory))
{
@ -269,6 +271,46 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
AssertConnectionDisconnectLog();
}
[ConditionalFact]
public async Task ReadsAlwaysGoAsync()
{
// A hypothesis on why there are flaky tests is due to read async not going
// async. Adding a test that confirms ReadAsync is async.
for (var i = 0; i < 10; i++)
{
var requestStartedCompletionSource = CreateTaskCompletionSource();
var requestCompletedCompletionSource = CreateTaskCompletionSource();
var data = new byte[1024];
using (var testServer = await TestServer.Create(async ctx =>
{
var task = ctx.Request.Body.ReadAsync(data);
Assert.True(!task.IsCompleted);
requestStartedCompletionSource.SetResult(true);
await task;
requestCompletedCompletionSource.SetResult(true);
}, LoggerFactory))
{
using (var connection = testServer.CreateConnection())
{
await SendContentLength1Post(connection);
await requestStartedCompletionSource.Task;
await connection.Send(
"a");
await connection.Receive(
"HTTP/1.1 200 OK",
""
);
}
await requestCompletedCompletionSource.Task.DefaultTimeout();
}
}
}
[ConditionalFact]
public async Task RequestAbortedIsTrippedWithoutIO()
{