From 870c430f8fd28811f1088e188cf00279cc98152a Mon Sep 17 00:00:00 2001 From: Chris Ross Date: Tue, 21 Apr 2015 13:12:16 -0700 Subject: [PATCH] Consume the checked in DeploymentHelpers. --- build.cmd | 2 + global.json | 2 +- .../HelloWorldTest.cs | 39 +++++++------------ .../NtlmAuthentationTest.cs | 21 +++------- .../project.json | 2 +- .../StartupHelloWorld.cs | 2 +- 6 files changed, 24 insertions(+), 44 deletions(-) diff --git a/build.cmd b/build.cmd index 41025afb26..812d058e94 100644 --- a/build.cmd +++ b/build.cmd @@ -21,7 +21,9 @@ IF EXIST packages\KoreBuild goto run IF "%SKIP_DNX_INSTALL%"=="1" goto run CALL packages\KoreBuild\build\dnvm upgrade -runtime CLR -arch x86 +CALL packages\KoreBuild\build\dnvm install default -runtime CLR -arch x64 CALL packages\KoreBuild\build\dnvm install default -runtime CoreCLR -arch x86 +CALL packages\KoreBuild\build\dnvm install default -runtime CoreCLR -arch x64 :run CALL packages\KoreBuild\build\dnvm use default -runtime CLR -arch x86 diff --git a/global.json b/global.json index 983ba0401e..d9b4ed63ae 100644 --- a/global.json +++ b/global.json @@ -1,3 +1,3 @@ { - "projects": ["src"] + "projects": [ "src" ] } diff --git a/test/ServerComparison.FunctionalTests/HelloWorldTest.cs b/test/ServerComparison.FunctionalTests/HelloWorldTest.cs index 724f8df513..ace78b0eaf 100644 --- a/test/ServerComparison.FunctionalTests/HelloWorldTest.cs +++ b/test/ServerComparison.FunctionalTests/HelloWorldTest.cs @@ -2,10 +2,9 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; -using System.Diagnostics; using System.Net.Http; using System.Threading.Tasks; -using DeploymentHelpers; +using Microsoft.AspNet.Server.Testing; using Microsoft.AspNet.Testing.xunit; using Microsoft.Framework.Logging; using Xunit; @@ -17,27 +16,27 @@ namespace ServerComparison.FunctionalTests { [ConditionalTheory] [OSSkipCondition(OperatingSystems.Unix | OperatingSystems.MacOSX)] - [InlineData(ServerType.IISExpress, RuntimeFlavor.coreclr, RuntimeArchitecture.x86, "http://localhost:5061/")] - [InlineData(ServerType.IISExpress, RuntimeFlavor.clr, RuntimeArchitecture.x64, "http://localhost:5062/")] - [InlineData(ServerType.WebListener, RuntimeFlavor.clr, RuntimeArchitecture.x86, "http://localhost:5063/")] - [InlineData(ServerType.WebListener, RuntimeFlavor.coreclr, RuntimeArchitecture.x64, "http://localhost:5064/")] + [InlineData(ServerType.IISExpress, RuntimeFlavor.CoreClr, RuntimeArchitecture.x86, "http://localhost:5061/")] + [InlineData(ServerType.IISExpress, RuntimeFlavor.Clr, RuntimeArchitecture.x64, "http://localhost:5062/")] + [InlineData(ServerType.WebListener, RuntimeFlavor.Clr, RuntimeArchitecture.x86, "http://localhost:5063/")] + [InlineData(ServerType.WebListener, RuntimeFlavor.CoreClr, RuntimeArchitecture.x64, "http://localhost:5064/")] public Task HelloWorld_Windows(ServerType serverType, RuntimeFlavor runtimeFlavor, RuntimeArchitecture architecture, string applicationBaseUrl) { return HelloWorld(serverType, runtimeFlavor, architecture, applicationBaseUrl); } [Theory] - [InlineData(ServerType.Kestrel, RuntimeFlavor.coreclr, RuntimeArchitecture.x86, "http://localhost:5065/")] - [InlineData(ServerType.Kestrel, RuntimeFlavor.clr, RuntimeArchitecture.x64, "http://localhost:5066/")] + [InlineData(ServerType.Kestrel, RuntimeFlavor.CoreClr, RuntimeArchitecture.x86, "http://localhost:5065/")] + [InlineData(ServerType.Kestrel, RuntimeFlavor.Clr, RuntimeArchitecture.x64, "http://localhost:5066/")] public Task HelloWorld_Kestrel(ServerType serverType, RuntimeFlavor runtimeFlavor, RuntimeArchitecture architecture, string applicationBaseUrl) { return HelloWorld(serverType, runtimeFlavor, architecture, applicationBaseUrl); } [ConditionalTheory] - [FrameworkSkipCondition(RuntimeFrameworks.DotNet)] - [InlineData(ServerType.Kestrel, RuntimeFlavor.mono, RuntimeArchitecture.x86, "http://localhost:5067/")] - [InlineData(ServerType.Kestrel, RuntimeFlavor.mono, RuntimeArchitecture.x64, "http://localhost:5068/")] + [FrameworkSkipCondition(RuntimeFrameworks.CLR)] + [InlineData(ServerType.Kestrel, RuntimeFlavor.Mono, RuntimeArchitecture.x86, "http://localhost:5067/")] + [InlineData(ServerType.Kestrel, RuntimeFlavor.Mono, RuntimeArchitecture.x64, "http://localhost:5068/")] public Task HelloWorld_Mono(ServerType serverType, RuntimeFlavor runtimeFlavor, RuntimeArchitecture architecture, string applicationBaseUrl) { return HelloWorld(serverType, runtimeFlavor, architecture, applicationBaseUrl); @@ -47,8 +46,8 @@ namespace ServerComparison.FunctionalTests [SkipIfIISVariationsNotEnabled] [OSSkipCondition(OperatingSystems.MacOSX | OperatingSystems.Unix)] [SkipIfCurrentRuntimeIsCoreClr] - [InlineData(ServerType.IIS, RuntimeFlavor.clr, RuntimeArchitecture.x64, "http://localhost:5069/")] - [InlineData(ServerType.IIS, RuntimeFlavor.coreclr, RuntimeArchitecture.x86, "http://localhost:5070/")] + [InlineData(ServerType.IIS, RuntimeFlavor.Clr, RuntimeArchitecture.x64, "http://localhost:5069/")] + [InlineData(ServerType.IIS, RuntimeFlavor.CoreClr, RuntimeArchitecture.x86, "http://localhost:5070/")] public Task HelloWorld_IIS_X86(ServerType serverType, RuntimeFlavor runtimeFlavor, RuntimeArchitecture architecture, string applicationBaseUrl) { return HelloWorld(serverType, runtimeFlavor, architecture, applicationBaseUrl); @@ -58,7 +57,7 @@ namespace ServerComparison.FunctionalTests [SkipIfIISNativeVariationsNotEnabled] [OSSkipCondition(OperatingSystems.Win7And2008R2 | OperatingSystems.MacOSX | OperatingSystems.Unix)] [SkipIfCurrentRuntimeIsCoreClr] - [InlineData(ServerType.IISNativeModule, RuntimeFlavor.coreclr, RuntimeArchitecture.x86, "http://localhost:5071/")] + [InlineData(ServerType.IISNativeModule, RuntimeFlavor.CoreClr, RuntimeArchitecture.x86, "http://localhost:5071/")] public Task HelloWorld_NativeModule_X86(ServerType serverType, RuntimeFlavor runtimeFlavor, RuntimeArchitecture architecture, string applicationBaseUrl) { return HelloWorld(serverType, runtimeFlavor, architecture, applicationBaseUrl); @@ -69,7 +68,7 @@ namespace ServerComparison.FunctionalTests [OSSkipCondition(OperatingSystems.Win7And2008R2 | OperatingSystems.MacOSX | OperatingSystems.Unix)] [SkipOn32BitOS] [SkipIfCurrentRuntimeIsCoreClr] - [InlineData(ServerType.IISNativeModule, RuntimeFlavor.coreclr, RuntimeArchitecture.x64, "http://localhost:5072/")] + [InlineData(ServerType.IISNativeModule, RuntimeFlavor.CoreClr, RuntimeArchitecture.x64, "http://localhost:5072/")] public Task HelloWorld_NativeModule_AMD64(ServerType serverType, RuntimeFlavor runtimeFlavor, RuntimeArchitecture architecture, string applicationBaseUrl) { return HelloWorld(serverType, runtimeFlavor, architecture, applicationBaseUrl); @@ -83,11 +82,6 @@ namespace ServerComparison.FunctionalTests using (logger.BeginScope("HelloWorldTest")) { - var stopwatch = Stopwatch.StartNew(); - - logger.LogInformation("Variation Details : HostType = {hostType}, RuntimeFlavor = {flavor}, Architecture = {arch}, applicationBaseUrl = {appBase}", - serverType, runtimeFlavor, architecture, applicationBaseUrl); - var deploymentParameters = new DeploymentParameters(Helpers.GetApplicationPath(), serverType, runtimeFlavor, architecture) { ApplicationBaseUriHint = applicationBaseUrl, @@ -106,13 +100,8 @@ namespace ServerComparison.FunctionalTests return httpClient.GetAsync(string.Empty); }, logger, deploymentResult.HostShutdownToken); - logger.LogInformation("[Time]: Approximate time taken for application initialization : '{t}' seconds", stopwatch.Elapsed.TotalSeconds); - var responseText = await response.Content.ReadAsStringAsync(); Assert.Equal("Hello World", responseText); - - stopwatch.Stop(); - logger.LogInformation("[Time]: Total time taken for this test variation '{t}' seconds", stopwatch.Elapsed.TotalSeconds); } } } diff --git a/test/ServerComparison.FunctionalTests/NtlmAuthentationTest.cs b/test/ServerComparison.FunctionalTests/NtlmAuthentationTest.cs index 4b13376170..dd73ecee40 100644 --- a/test/ServerComparison.FunctionalTests/NtlmAuthentationTest.cs +++ b/test/ServerComparison.FunctionalTests/NtlmAuthentationTest.cs @@ -2,12 +2,11 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; -using System.Diagnostics; using System.IO; using System.Net; using System.Net.Http; using System.Threading.Tasks; -using DeploymentHelpers; +using Microsoft.AspNet.Server.Testing; using Microsoft.AspNet.Testing.xunit; using Microsoft.Framework.Logging; using Xunit; @@ -19,10 +18,10 @@ namespace ServerComparison.FunctionalTests { [ConditionalTheory, Trait("ServerComparison.FunctionalTests", "ServerComparison.FunctionalTests")] [OSSkipCondition(OperatingSystems.Unix | OperatingSystems.MacOSX)] - [InlineData(ServerType.IISExpress, RuntimeFlavor.coreclr, RuntimeArchitecture.x86, "http://localhost:5050/")] - [InlineData(ServerType.IISExpress, RuntimeFlavor.clr, RuntimeArchitecture.x64, "http://localhost:5051/")] - [InlineData(ServerType.WebListener, RuntimeFlavor.clr, RuntimeArchitecture.x86, "http://localhost:5052/")] - [InlineData(ServerType.WebListener, RuntimeFlavor.coreclr, RuntimeArchitecture.x64, "http://localhost:5052/")] + [InlineData(ServerType.IISExpress, RuntimeFlavor.CoreClr, RuntimeArchitecture.x86, "http://localhost:5050/")] + [InlineData(ServerType.IISExpress, RuntimeFlavor.Clr, RuntimeArchitecture.x64, "http://localhost:5051/")] + [InlineData(ServerType.WebListener, RuntimeFlavor.Clr, RuntimeArchitecture.x86, "http://localhost:5052/")] + [InlineData(ServerType.WebListener, RuntimeFlavor.CoreClr, RuntimeArchitecture.x64, "http://localhost:5052/")] public async Task NtlmAuthentication(ServerType serverType, RuntimeFlavor runtimeFlavor, RuntimeArchitecture architecture, string applicationBaseUrl) { var logger = new LoggerFactory() @@ -31,11 +30,6 @@ namespace ServerComparison.FunctionalTests using (logger.BeginScope("NtlmAuthenticationTest")) { - var stopwatch = Stopwatch.StartNew(); - - logger.LogInformation("Variation Details : HostType = {hostType}, RuntimeFlavor = {flavor}, Architecture = {arch}, applicationBaseUrl = {appBase}", - serverType, runtimeFlavor, architecture, applicationBaseUrl); - var deploymentParameters = new DeploymentParameters(Helpers.GetApplicationPath(), serverType, runtimeFlavor, architecture) { ApplicationBaseUriHint = applicationBaseUrl, @@ -56,8 +50,6 @@ namespace ServerComparison.FunctionalTests return httpClient.GetAsync(string.Empty); }, logger, deploymentResult.HostShutdownToken); - logger.LogInformation("[Time]: Approximate time taken for application initialization : '{t}' seconds", stopwatch.Elapsed.TotalSeconds); - var responseText = await response.Content.ReadAsStringAsync(); Assert.Equal("Hello World", responseText); @@ -72,9 +64,6 @@ namespace ServerComparison.FunctionalTests httpClient = new HttpClient(httpClientHandler) { BaseAddress = new Uri(deploymentResult.ApplicationBaseUri) }; responseText = await httpClient.GetStringAsync("/Restricted"); Assert.Equal("NotAnonymous", responseText); - - stopwatch.Stop(); - logger.LogInformation("[Time]: Total time taken for this test variation '{t}' seconds", stopwatch.Elapsed.TotalSeconds); } } } diff --git a/test/ServerComparison.FunctionalTests/project.json b/test/ServerComparison.FunctionalTests/project.json index 274a0fd662..3313f26c4d 100644 --- a/test/ServerComparison.FunctionalTests/project.json +++ b/test/ServerComparison.FunctionalTests/project.json @@ -6,8 +6,8 @@ "test": "xunit.runner.aspnet" }, "dependencies": { - "DeploymentHelpers": "1.0.0-*", "Microsoft.AspNet.Server.IIS": "1.0.0-*", + "Microsoft.AspNet.Server.Testing": "1.0.0-*", "Microsoft.Framework.Logging.Console": "1.0.0-*", "xunit.runner.aspnet": "2.0.0-aspnet-*" }, diff --git a/test/ServerComparison.TestSites/StartupHelloWorld.cs b/test/ServerComparison.TestSites/StartupHelloWorld.cs index ba97b49cb0..06b340c152 100644 --- a/test/ServerComparison.TestSites/StartupHelloWorld.cs +++ b/test/ServerComparison.TestSites/StartupHelloWorld.cs @@ -15,7 +15,7 @@ namespace ServerComparison.TestSites /// To make runtime to load an environment based startup class, specify the environment by the following ways: /// 1. Drop a Microsoft.AspNet.Hosting.ini file in the wwwroot folder /// 2. Add a setting in the ini file named 'ASPNET_ENV' with value of the format 'Startup[EnvironmentName]'. For example: To load a Startup class named - /// 'StartupHelloWorld' the value of the env should be 'NtlmAuthentication' (eg. ASPNET_ENV=HelloWorld). Runtime adds a 'Startup' prefix to this and loads 'StartupHelloWorld'. + /// 'StartupHelloWorld' the value of the env should be 'HelloWorld' (eg. ASPNET_ENV=HelloWorld). Runtime adds a 'Startup' prefix to this and loads 'StartupHelloWorld'. /// If no environment name is specified the default startup class loaded is 'Startup'. /// Alternative ways to specify environment are: /// 1. Set the environment variable named SET ASPNET_ENV=HelloWorld