Skipping flaky test and additional additional diagnositcs to Shutdown command

This commit is contained in:
Pranav K 2018-03-05 15:24:33 -08:00
parent 0d321771ad
commit c4ba279fb5
No known key found for this signature in database
GPG Key ID: 1963DA6D96C3057A
3 changed files with 17 additions and 7 deletions

View File

@ -57,19 +57,21 @@ namespace Microsoft.AspNetCore.Razor.Tools
var process = Process.GetProcessById(response.ServerProcessId);
process.WaitForExit();
}
catch (Exception)
catch (Exception ex)
{
// There is an inherent race here with the server process. If it has already shutdown
// by the time we try to access it then the operation has succeed.
// by the time we try to access it then the operation has succeeded.
Error.Write(ex);
}
Out.Write("Server pid:{0} shut down", response.ServerProcessId);
}
}
}
catch (Exception) when (IsServerRunning())
catch (Exception ex) when (IsServerRunning())
{
// Ignore an exception that occurred while the server was shutting down.
Error.Write(ex);
}
return 0;

View File

@ -31,16 +31,23 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests
// Shutdown the build server.
using (var cts = new CancellationTokenSource(_defaultShutdownTimeout))
{
var writer = new StringWriter();
cts.Token.Register(() =>
{
throw new TimeoutException($"Shutting down the build server at pipe {PipeName} took longer than expected.");
var output = writer.ToString();
throw new TimeoutException($"Shutting down the build server at pipe {PipeName} took longer than expected.{Environment.NewLine}Output: {output}.");
});
var application = new Application(cts.Token, Mock.Of<ExtensionAssemblyLoader>(), Mock.Of<ExtensionDependencyChecker>(), (path, properties) => Mock.Of<PortableExecutableReference>());
var application = new Application(cts.Token, Mock.Of<ExtensionAssemblyLoader>(), Mock.Of<ExtensionDependencyChecker>(), (path, properties) => Mock.Of<PortableExecutableReference>())
{
Out = writer,
Error = writer,
};
var exitCode = application.Execute("shutdown", "-w", "-p", PipeName);
if (exitCode != 0)
{
var output = application.Error.ToString();
var output = writer.ToString();
throw new InvalidOperationException(
$"Build server at pipe {PipeName} failed to shutdown with exit code {exitCode}. Output: {output}");
}

View File

@ -203,7 +203,8 @@ namespace Microsoft.AspNetCore.Razor.Tools
}
}
[Fact]
[ConditionalFact(Skip = "https://github.com/aspnet/Razor/issues/1991")]
[OSSkipCondition(OperatingSystems.Linux | OperatingSystems.MacOSX)]
public async Task ServerRunning_CancelCompilation_CancelsSuccessfully()
{
// Arrange