On test completion, kill the ASP.NET process tree (otherwise orphan processes are left behind)

This commit is contained in:
Steve Sanderson 2017-11-20 22:31:48 +00:00
parent 352d05030b
commit 76cb441a8e
4 changed files with 8 additions and 4 deletions

View File

@ -25,6 +25,7 @@
<MicrosoftEntityFrameworkCoreToolsDotNetPackageVersion>2.1.0-preview1-27625</MicrosoftEntityFrameworkCoreToolsDotNetPackageVersion>
<MicrosoftEntityFrameworkCoreToolsPackageVersion>2.1.0-preview1-27625</MicrosoftEntityFrameworkCoreToolsPackageVersion>
<MicrosoftExtensionsCommandLineUtilsSourcesPackageVersion>2.1.0-preview1-27625</MicrosoftExtensionsCommandLineUtilsSourcesPackageVersion>
<MicrosoftExtensionsProcessSourcesPackageVersion>2.1.0-preview1-27625</MicrosoftExtensionsProcessSourcesPackageVersion>
<MicrosoftExtensionsSecretManagerToolsPackageVersion>2.1.0-preview1-27625</MicrosoftExtensionsSecretManagerToolsPackageVersion>
<MicrosoftNETCoreApp20PackageVersion>2.0.0</MicrosoftNETCoreApp20PackageVersion>
<MicrosoftNETCoreApp21PackageVersion>2.1.0-preview1-25907-02</MicrosoftNETCoreApp21PackageVersion>

View File

@ -1,4 +1,5 @@
using System;
using Microsoft.Extensions.Internal;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Diagnostics;
@ -136,8 +137,7 @@ namespace Templates.Test.Helpers
{
if (_process != null && !_process.HasExited)
{
_process.Kill();
_process.WaitForExit(5000);
_process.KillTree();
}
}

View File

@ -26,7 +26,9 @@ namespace Templates.Test.SpaTemplateTest
// For some SPA templates, the NPM root directory is './ClientApp'. In other
// templates it's at the project root. Strictly speaking we shouldn't have
// to do the NPM restore in tests because it should happen automatically at
// build time, but the tests run a lot faster this way because we can use Yarn.
// build time, but by doing it up front we can avoid having multiple NPM
// installs run concurrently which otherwise causes errors when tests run
// in parallel.
if (File.Exists(Path.Combine(TemplateOutputDir, "ClientApp", "package.json")))
{
InstallNpmPackages("ClientApp");

View File

@ -8,6 +8,7 @@
<PackageReference Include="Internal.AspNetCore.Sdk" Version="$(InternalAspNetCoreSdkPackageVersion)" />
<PackageReference Include="Microsoft.AspNetCore.Testing" Version="$(MicrosoftAspNetCoreTestingPackageVersion)" />
<PackageReference Include="Microsoft.Extensions.CommandLineUtils.Sources" Version="$(MicrosoftExtensionsCommandLineUtilsSourcesPackageVersion)" />
<PackageReference Include="Microsoft.Extensions.Process.Sources" Version="$(MicrosoftExtensionsProcessSourcesPackageVersion)" PrivateAssets="All" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="$(MicrosoftNETTestSdkPackageVersion)" />
<PackageReference Include="Selenium.Firefox.WebDriver" Version="$(SeleniumFirefoxWebDriverPackageVersion)" />
<PackageReference Include="Selenium.Support" Version="$(SeleniumSupportPackageVersion)" NoWarn="NU1701" />