Moving the host start process into the try block

To make sure the host process is not left unkilled after a failure in host start complete.
This commit is contained in:
Praburaj 2014-06-08 13:54:07 -07:00
parent c5f2b4054f
commit 022ff067ad
1 changed files with 8 additions and 3 deletions

View File

@ -1,4 +1,5 @@
using System;
using System.Diagnostics;
using System.Collections.Generic;
using System.Net;
using System.Net.Http;
@ -33,10 +34,11 @@ namespace E2ETests
Environment.SetEnvironmentVariable("SQLAZURECONNSTR_IdentityConnection", string.Format(Connection_string_Format, musicStoreIdentityDbName));
ApplicationBaseUrl = applicationBaseUrl;
var hostProcess = DeploymentUtility.StartApplication(hostType, kreFlavor, musicStoreIdentityDbName);
Process hostProcess = null;
try
{
hostProcess = DeploymentUtility.StartApplication(hostType, kreFlavor, musicStoreIdentityDbName);
httpClientHandler = new HttpClientHandler();
httpClient = new HttpClient(httpClientHandler) { BaseAddress = new Uri(applicationBaseUrl) };
@ -104,8 +106,11 @@ namespace E2ETests
}
finally
{
//Shutdown the host process
hostProcess.Kill();
if (hostProcess != null)
{
//Shutdown the host process
hostProcess.Kill();
}
DbUtils.DropDatabase(musicStoreDbName);
DbUtils.DropDatabase(musicStoreIdentityDbName);