Adding kestrel variation of the MusicStore tests

Variation added for both Desktop & CoreCLR.
Added some more diagnostics to help better trouble shoot with more variations.
This commit is contained in:
Praburaj 2014-07-02 17:32:31 -07:00
parent ecbf6e27fa
commit 974bfcab7a
6 changed files with 39 additions and 25 deletions

View File

@ -5,6 +5,7 @@
"description": "Music store application on K", "description": "Music store application on K",
"version": "1.0.0-*", "version": "1.0.0-*",
"dependencies": { "dependencies": {
"Kestrel": "1.0.0-*",
"Microsoft.AspNet.Server.IIS": "1.0.0-*", "Microsoft.AspNet.Server.IIS": "1.0.0-*",
"Microsoft.AspNet.Mvc": "6.0.0-*", "Microsoft.AspNet.Mvc": "6.0.0-*",
"Microsoft.AspNet.Server.WebListener": "1.0.0-*", "Microsoft.AspNet.Server.WebListener": "1.0.0-*",
@ -18,13 +19,12 @@
"Microsoft.Framework.OptionsModel": "1.0.0-*" "Microsoft.Framework.OptionsModel": "1.0.0-*"
}, },
"commands": { "commands": {
"web": "Microsoft.AspNet.Hosting --server Microsoft.AspNet.Server.WebListener --server.urls http://localhost:5002", "WebListener": "Microsoft.AspNet.Hosting --server Microsoft.AspNet.Server.WebListener --server.urls http://localhost:5002",
"Kestrel": "Microsoft.AspNet.Hosting --server Kestrel --server.urls http://localhost:5004",
"run": "run server.urls=http://localhost:5003" "run": "run server.urls=http://localhost:5003"
}, },
"configurations": { "configurations": {
"net451": { "net451": { },
}, "k10": { }
"k10": {
}
} }
} }

View File

@ -43,7 +43,7 @@ namespace E2ETests
private const string APP_RELATIVE_PATH = @"..\..\src\MusicStore\"; private const string APP_RELATIVE_PATH = @"..\..\src\MusicStore\";
public static Process StartApplication(HostType hostType, KreFlavor kreFlavor, string identityDbName) public static Process StartApplication(ServerType hostType, KreFlavor kreFlavor, string identityDbName)
{ {
string applicationPath = Path.GetFullPath(Path.Combine(Environment.CurrentDirectory, APP_RELATIVE_PATH)); string applicationPath = Path.GetFullPath(Path.Combine(Environment.CurrentDirectory, APP_RELATIVE_PATH));
//Tweak the %PATH% to the point to the right KREFLAVOR //Tweak the %PATH% to the point to the right KREFLAVOR
@ -53,13 +53,13 @@ namespace E2ETests
Environment.SetEnvironmentVariable("KRE_DEFAULT_LIB", string.Empty); Environment.SetEnvironmentVariable("KRE_DEFAULT_LIB", string.Empty);
Process hostProcess = null; Process hostProcess = null;
if (hostType == HostType.Helios) if (hostType == ServerType.Helios)
{ {
hostProcess = StartHeliosHost(applicationPath); hostProcess = StartHeliosHost(applicationPath);
} }
else else
{ {
hostProcess = StartSelfHost(applicationPath, identityDbName); hostProcess = StartSelfHost(hostType, applicationPath, identityDbName);
} }
//Restore the KRE_DEFAULT_LIB after starting the host process //Restore the KRE_DEFAULT_LIB after starting the host process
@ -85,12 +85,14 @@ namespace E2ETests
return hostProcess; return hostProcess;
} }
private static Process StartSelfHost(string applicationPath, string identityDbName) private static Process StartSelfHost(ServerType hostType, string applicationPath, string identityDbName)
{ {
Console.WriteLine(string.Format("Executing klr.exe --appbase {0} \"Microsoft.Framework.ApplicationHost\" {1}", applicationPath, hostType.ToString()));
var startInfo = new ProcessStartInfo var startInfo = new ProcessStartInfo
{ {
FileName = "klr.exe", FileName = "klr.exe",
Arguments = string.Format("--appbase {0} \"Microsoft.Framework.ApplicationHost\" web", applicationPath), Arguments = string.Format("--appbase {0} \"Microsoft.Framework.ApplicationHost\" {1}", applicationPath, hostType.ToString()),
UseShellExecute = true, UseShellExecute = true,
CreateNoWindow = true CreateNoWindow = true
}; };

View File

@ -29,7 +29,7 @@
<Compile Include="DeploymentUtility.cs" /> <Compile Include="DeploymentUtility.cs" />
<Compile Include="DbUtils.cs" /> <Compile Include="DbUtils.cs" />
<Compile Include="Extensions.cs" /> <Compile Include="Extensions.cs" />
<Compile Include="HostType.cs" /> <Compile Include="ServerType.cs" />
<Compile Include="HtmlDOMHelper.cs" /> <Compile Include="HtmlDOMHelper.cs" />
<Compile Include="KreFlavor.cs" /> <Compile Include="KreFlavor.cs" />
<Compile Include="SmokeTests.cs" /> <Compile Include="SmokeTests.cs" />

View File

@ -1,8 +0,0 @@
namespace E2ETests
{
public enum HostType
{
Helios,
SelfHost
}
}

View File

@ -0,0 +1,9 @@
namespace E2ETests
{
public enum ServerType
{
Helios,
WebListener,
Kestrel
}
}

View File

@ -16,12 +16,16 @@ namespace E2ETests
private HttpClientHandler httpClientHandler; private HttpClientHandler httpClientHandler;
[Theory] [Theory]
[InlineData(HostType.Helios, KreFlavor.DesktopClr, "http://localhost:5001/")] [InlineData(ServerType.Helios, KreFlavor.DesktopClr, "http://localhost:5001/")]
[InlineData(HostType.SelfHost, KreFlavor.DesktopClr, "http://localhost:5002/")] [InlineData(ServerType.WebListener, KreFlavor.DesktopClr, "http://localhost:5002/")]
[InlineData(HostType.Helios, KreFlavor.CoreClr, "http://localhost:5001/")] [InlineData(ServerType.Kestrel, KreFlavor.DesktopClr, "http://localhost:5004/")]
[InlineData(HostType.SelfHost, KreFlavor.CoreClr, "http://localhost:5002/")] [InlineData(ServerType.Helios, KreFlavor.CoreClr, "http://localhost:5001/")]
public void SmokeTestSuite(HostType hostType, KreFlavor kreFlavor, string applicationBaseUrl) [InlineData(ServerType.WebListener, KreFlavor.CoreClr, "http://localhost:5002/")]
[InlineData(ServerType.Kestrel, KreFlavor.CoreClr, "http://localhost:5004/")]
public void SmokeTestSuite(ServerType hostType, KreFlavor kreFlavor, string applicationBaseUrl)
{ {
Console.WriteLine("Variation Details : HostType = {0}, KreFlavor = {1}, applicationBaseUrl = {2}", hostType, kreFlavor, applicationBaseUrl);
var testStartTime = DateTime.Now; var testStartTime = DateTime.Now;
var musicStoreDbName = Guid.NewGuid().ToString().Replace("-", string.Empty); var musicStoreDbName = Guid.NewGuid().ToString().Replace("-", string.Empty);
var musicStoreIdentityDbName = Guid.NewGuid().ToString().Replace("-", string.Empty); var musicStoreIdentityDbName = Guid.NewGuid().ToString().Replace("-", string.Empty);
@ -35,6 +39,7 @@ namespace E2ETests
ApplicationBaseUrl = applicationBaseUrl; ApplicationBaseUrl = applicationBaseUrl;
Process hostProcess = null; Process hostProcess = null;
bool testSuccessful = false;
try try
{ {
@ -103,9 +108,15 @@ namespace E2ETests
var testCompletionTime = DateTime.Now; var testCompletionTime = DateTime.Now;
Console.WriteLine("[Time]: All tests completed in '{0}' seconds", (testCompletionTime - initializationCompleteTime).TotalSeconds); Console.WriteLine("[Time]: All tests completed in '{0}' seconds", (testCompletionTime - initializationCompleteTime).TotalSeconds);
Console.WriteLine("[Time]: Total time taken for this test variation '{0}' seconds", (testCompletionTime - testStartTime).TotalSeconds); Console.WriteLine("[Time]: Total time taken for this test variation '{0}' seconds", (testCompletionTime - testStartTime).TotalSeconds);
testSuccessful = true;
} }
finally finally
{ {
if (!testSuccessful)
{
Console.WriteLine("Some tests failed. Proceeding with cleanup.");
}
if (hostProcess != null && !hostProcess.HasExited) if (hostProcess != null && !hostProcess.HasExited)
{ {
//Shutdown the host process //Shutdown the host process