Dispose server before checking test sink (#940)

This commit is contained in:
Justin Kotalik 2018-06-19 14:41:34 -07:00 committed by GitHub
parent b24a838301
commit a159cadf18
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 15 additions and 2 deletions

View File

@ -33,7 +33,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
Assert.Equal("Hello World", responseText); Assert.Equal("Hello World", responseText);
Dispose(); StopServer();
var folderPath = Path.Combine(deploymentResult.DeploymentResult.ContentRoot, @"logs"); var folderPath = Path.Combine(deploymentResult.DeploymentResult.ContentRoot, @"logs");

View File

@ -29,6 +29,8 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
Assert.Equal(HttpStatusCode.InternalServerError, response.StatusCode); Assert.Equal(HttpStatusCode.InternalServerError, response.StatusCode);
StopServer();
Assert.Contains(TestSink.Writes, context => context.Message.Contains($"Random number: {randomNumberString}")); Assert.Contains(TestSink.Writes, context => context.Message.Contains($"Random number: {randomNumberString}"));
} }
@ -48,6 +50,8 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
Assert.Equal(HttpStatusCode.InternalServerError, response.StatusCode); Assert.Equal(HttpStatusCode.InternalServerError, response.StatusCode);
StopServer();
Assert.Contains(TestSink.Writes, context => context.Message.Contains(new string('a', 4096))); Assert.Contains(TestSink.Writes, context => context.Message.Contains(new string('a', 4096)));
} }
} }

View File

@ -126,6 +126,9 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
var deploymentResult = await DeployAsync(GetBaseDeploymentParameters("OverriddenServerWebSite")); var deploymentResult = await DeployAsync(GetBaseDeploymentParameters("OverriddenServerWebSite"));
var response = await deploymentResult.HttpClient.GetAsync("/"); var response = await deploymentResult.HttpClient.GetAsync("/");
Assert.False(response.IsSuccessStatusCode); Assert.False(response.IsSuccessStatusCode);
StopServer();
Assert.Contains(TestSink.Writes, context => context.Message.Contains("Application is running inside IIS process but is not configured to use IIS server")); Assert.Contains(TestSink.Writes, context => context.Message.Contains("Application is running inside IIS process but is not configured to use IIS server"));
} }

View File

@ -119,7 +119,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
Assert.Equal(_helloWorldResponse, responseText); Assert.Equal(_helloWorldResponse, responseText);
Dispose(); StopServer();
deploymentResult = await DeployAsync(deploymentParameters); deploymentResult = await DeployAsync(deploymentParameters);

View File

@ -32,8 +32,14 @@ namespace Microsoft.AspNetCore.Server.IntegrationTesting
} }
public override void Dispose() public override void Dispose()
{
StopServer();
}
public void StopServer()
{ {
_deployer?.Dispose(); _deployer?.Dispose();
_deployer = null;
} }
} }
} }