From e2b4842680bee50890f95efda7f2e6202f98825d Mon Sep 17 00:00:00 2001 From: Praburaj Date: Tue, 10 Jun 2014 12:17:17 -0700 Subject: [PATCH] Adding some more diagnostic logs for cleanup This is to confirm that the host process started by the tests are cleaned up at the end of the test. --- test/E2ETests/DeploymentUtility.cs | 10 ++++++++-- test/E2ETests/SmokeTests.cs | 9 +++++++++ 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/test/E2ETests/DeploymentUtility.cs b/test/E2ETests/DeploymentUtility.cs index 80683793d6..205d9e5f4e 100644 --- a/test/E2ETests/DeploymentUtility.cs +++ b/test/E2ETests/DeploymentUtility.cs @@ -48,17 +48,23 @@ namespace E2ETests string applicationPath = Path.GetFullPath(Path.Combine(Environment.CurrentDirectory, APP_RELATIVE_PATH)); //Tweak the %PATH% to the point to the right KREFLAVOR Environment.SetEnvironmentVariable("PATH", SwitchPathToKreFlavor(kreFlavor)); + var backupKreDefaultLibPath = Environment.GetEnvironmentVariable("KRE_DEFAULT_LIB"); //To avoid the KRE_DEFAULT_LIB of the test process flowing into Helios, set it to empty Environment.SetEnvironmentVariable("KRE_DEFAULT_LIB", string.Empty); + Process hostProcess = null; if (hostType == HostType.Helios) { - return StartHeliosHost(applicationPath); + hostProcess = StartHeliosHost(applicationPath); } else { - return StartSelfHost(applicationPath, identityDbName); + hostProcess = StartSelfHost(applicationPath, identityDbName); } + + //Restore the KRE_DEFAULT_LIB after starting the host process + Environment.SetEnvironmentVariable("KRE_DEFAULT_LIB", backupKreDefaultLibPath); + return hostProcess; } private static Process StartHeliosHost(string applicationPath) diff --git a/test/E2ETests/SmokeTests.cs b/test/E2ETests/SmokeTests.cs index b0711d9a22..12d402c7bc 100644 --- a/test/E2ETests/SmokeTests.cs +++ b/test/E2ETests/SmokeTests.cs @@ -110,6 +110,15 @@ namespace E2ETests { //Shutdown the host process hostProcess.Kill(); + hostProcess.WaitForExit(5 * 1000); + if (!hostProcess.HasExited) + { + Console.WriteLine("Unable to terminate the host process with process Id '{0}", hostProcess.Id); + } + else + { + Console.WriteLine("Successfully terminated host process with process Id '{0}'", hostProcess.Id); + } } DbUtils.DropDatabase(musicStoreDbName);