react to aspnet/Hosting#996 (#349)
This commit is contained in:
parent
a06a765cf4
commit
676590eb32
|
|
@ -1,6 +1,6 @@
|
||||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
# Visual Studio 15
|
# Visual Studio 15
|
||||||
VisualStudioVersion = 15.0.26228.4
|
VisualStudioVersion = 15.0.26228.10
|
||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{04B1EDB6-E967-4D25-89B9-E6F8304038CD}"
|
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{04B1EDB6-E967-4D25-89B9-E6F8304038CD}"
|
||||||
EndProject
|
EndProject
|
||||||
|
|
@ -18,12 +18,20 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IISSample", "samples\IISSam
|
||||||
EndProject
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Server.IISIntegration", "src\Microsoft.AspNetCore.Server.IISIntegration\Microsoft.AspNetCore.Server.IISIntegration.csproj", "{8B3446E8-E6A8-4591-AA63-A95837C6E97C}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Server.IISIntegration", "src\Microsoft.AspNetCore.Server.IISIntegration\Microsoft.AspNetCore.Server.IISIntegration.csproj", "{8B3446E8-E6A8-4591-AA63-A95837C6E97C}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests", "test\FunctionalTests\FunctionalTests.csproj", "{7F2F50C7-610F-4B69-B945-CA283511A587}"
|
|
||||||
EndProject
|
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Server.IISIntegration.Tests", "test\Microsoft.AspNetCore.Server.IISIntegration.Tests\Microsoft.AspNetCore.Server.IISIntegration.Tests.csproj", "{4106DB10-E09F-480E-9CE6-B39235512EE6}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Server.IISIntegration.Tests", "test\Microsoft.AspNetCore.Server.IISIntegration.Tests\Microsoft.AspNetCore.Server.IISIntegration.Tests.csproj", "{4106DB10-E09F-480E-9CE6-B39235512EE6}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestSites", "test\TestSites\TestSites.csproj", "{F54715C3-88D8-49E3-A291-C13570FE81FC}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestSites", "test\TestSites\TestSites.csproj", "{F54715C3-88D8-49E3-A291-C13570FE81FC}"
|
||||||
EndProject
|
EndProject
|
||||||
|
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{7E80C58E-9CC8-450C-8A8D-94FC76428150}"
|
||||||
|
ProjectSection(SolutionItems) = preProject
|
||||||
|
build\common.props = build\common.props
|
||||||
|
build\dependencies.props = build\dependencies.props
|
||||||
|
build\Key.snk = build\Key.snk
|
||||||
|
build\repo.props = build\repo.props
|
||||||
|
EndProjectSection
|
||||||
|
EndProject
|
||||||
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FunctionalTests", "test\FunctionalTests\FunctionalTests.csproj", "{A2F7598B-85E1-4F53-B307-55F2A21D39A2}"
|
||||||
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
|
@ -38,10 +46,6 @@ Global
|
||||||
{8B3446E8-E6A8-4591-AA63-A95837C6E97C}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{8B3446E8-E6A8-4591-AA63-A95837C6E97C}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{8B3446E8-E6A8-4591-AA63-A95837C6E97C}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{8B3446E8-E6A8-4591-AA63-A95837C6E97C}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{8B3446E8-E6A8-4591-AA63-A95837C6E97C}.Release|Any CPU.Build.0 = Release|Any CPU
|
{8B3446E8-E6A8-4591-AA63-A95837C6E97C}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
{7F2F50C7-610F-4B69-B945-CA283511A587}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
|
||||||
{7F2F50C7-610F-4B69-B945-CA283511A587}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
|
||||||
{7F2F50C7-610F-4B69-B945-CA283511A587}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
|
||||||
{7F2F50C7-610F-4B69-B945-CA283511A587}.Release|Any CPU.Build.0 = Release|Any CPU
|
|
||||||
{4106DB10-E09F-480E-9CE6-B39235512EE6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{4106DB10-E09F-480E-9CE6-B39235512EE6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{4106DB10-E09F-480E-9CE6-B39235512EE6}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{4106DB10-E09F-480E-9CE6-B39235512EE6}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{4106DB10-E09F-480E-9CE6-B39235512EE6}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{4106DB10-E09F-480E-9CE6-B39235512EE6}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
|
@ -50,6 +54,10 @@ Global
|
||||||
{F54715C3-88D8-49E3-A291-C13570FE81FC}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{F54715C3-88D8-49E3-A291-C13570FE81FC}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{F54715C3-88D8-49E3-A291-C13570FE81FC}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{F54715C3-88D8-49E3-A291-C13570FE81FC}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{F54715C3-88D8-49E3-A291-C13570FE81FC}.Release|Any CPU.Build.0 = Release|Any CPU
|
{F54715C3-88D8-49E3-A291-C13570FE81FC}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{A2F7598B-85E1-4F53-B307-55F2A21D39A2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{A2F7598B-85E1-4F53-B307-55F2A21D39A2}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{A2F7598B-85E1-4F53-B307-55F2A21D39A2}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{A2F7598B-85E1-4F53-B307-55F2A21D39A2}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
|
@ -57,8 +65,8 @@ Global
|
||||||
GlobalSection(NestedProjects) = preSolution
|
GlobalSection(NestedProjects) = preSolution
|
||||||
{E4E2BDC4-A9C6-4AE9-B429-032EC83EDE64} = {C74B8F36-FD2F-45C9-9B8A-00E7CF0126A9}
|
{E4E2BDC4-A9C6-4AE9-B429-032EC83EDE64} = {C74B8F36-FD2F-45C9-9B8A-00E7CF0126A9}
|
||||||
{8B3446E8-E6A8-4591-AA63-A95837C6E97C} = {04B1EDB6-E967-4D25-89B9-E6F8304038CD}
|
{8B3446E8-E6A8-4591-AA63-A95837C6E97C} = {04B1EDB6-E967-4D25-89B9-E6F8304038CD}
|
||||||
{7F2F50C7-610F-4B69-B945-CA283511A587} = {EF30B533-D715-421A-92B7-92FEF460AC9C}
|
|
||||||
{4106DB10-E09F-480E-9CE6-B39235512EE6} = {EF30B533-D715-421A-92B7-92FEF460AC9C}
|
{4106DB10-E09F-480E-9CE6-B39235512EE6} = {EF30B533-D715-421A-92B7-92FEF460AC9C}
|
||||||
{F54715C3-88D8-49E3-A291-C13570FE81FC} = {EF30B533-D715-421A-92B7-92FEF460AC9C}
|
{F54715C3-88D8-49E3-A291-C13570FE81FC} = {EF30B533-D715-421A-92B7-92FEF460AC9C}
|
||||||
|
{A2F7598B-85E1-4F53-B307-55F2A21D39A2} = {EF30B533-D715-421A-92B7-92FEF460AC9C}
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
EndGlobal
|
EndGlobal
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,8 @@
|
||||||
<Project>
|
<Project>
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<AspNetCoreVersion>1.2.0-*</AspNetCoreVersion>
|
<AspNetCoreVersion>1.2.0-*</AspNetCoreVersion>
|
||||||
<AspNetCoreLabsVersion>0.3.0-*</AspNetCoreLabsVersion>
|
<AspNetCoreLabsVersion>0.3.0-*</AspNetCoreLabsVersion>
|
||||||
|
<AspNetCoreIntegrationTestingVersion>0.4.0-*</AspNetCoreIntegrationTestingVersion>
|
||||||
<AspNetCoreModuleVersion>1.0.0-*</AspNetCoreModuleVersion>
|
<AspNetCoreModuleVersion>1.0.0-*</AspNetCoreModuleVersion>
|
||||||
<CoreFxVersion>4.3.0</CoreFxVersion>
|
<CoreFxVersion>4.3.0</CoreFxVersion>
|
||||||
<InternalAspNetCoreSdkVersion>2.0.0-*</InternalAspNetCoreSdkVersion>
|
<InternalAspNetCoreSdkVersion>2.0.0-*</InternalAspNetCoreSdkVersion>
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,8 @@
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Server.IntegrationTesting" Version="$(AspNetCoreLabsVersion)" />
|
<PackageReference Include="Microsoft.AspNetCore.Server.IntegrationTesting" Version="$(AspNetCoreIntegrationTestingVersion)" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Logging.Testing" Version="$(AspNetCoreVersion)" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="$(AspNetCoreVersion)" />
|
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="$(AspNetCoreVersion)" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="$(AspNetCoreVersion)" />
|
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="$(AspNetCoreVersion)" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Logging" Version="$(AspNetCoreVersion)" />
|
<PackageReference Include="Microsoft.Extensions.Logging" Version="$(AspNetCoreVersion)" />
|
||||||
|
|
|
||||||
|
|
@ -9,58 +9,64 @@ using Microsoft.AspNetCore.Server.IntegrationTesting;
|
||||||
using Microsoft.AspNetCore.Testing.xunit;
|
using Microsoft.AspNetCore.Testing.xunit;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
using Xunit.Abstractions;
|
||||||
using Xunit.Sdk;
|
using Xunit.Sdk;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
|
namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
|
||||||
{
|
{
|
||||||
// Uses ports ranging 5061 - 5069.
|
|
||||||
public class HelloWorldTests
|
public class HelloWorldTests
|
||||||
{
|
{
|
||||||
|
private readonly ITestOutputHelper _output;
|
||||||
|
|
||||||
|
public HelloWorldTests(ITestOutputHelper output)
|
||||||
|
{
|
||||||
|
_output = output;
|
||||||
|
}
|
||||||
|
|
||||||
[ConditionalTheory]
|
[ConditionalTheory]
|
||||||
[OSSkipCondition(OperatingSystems.Linux | OperatingSystems.MacOSX)]
|
[OSSkipCondition(OperatingSystems.Linux | OperatingSystems.MacOSX)]
|
||||||
[FrameworkSkipCondition(RuntimeFrameworks.CoreCLR)]
|
[FrameworkSkipCondition(RuntimeFrameworks.CoreCLR)]
|
||||||
//[InlineData(RuntimeFlavor.Clr, RuntimeArchitecture.x86, "http://localhost:5061/", ServerType.Kestrel, ApplicationType.Portable)]
|
//[InlineData(RuntimeFlavor.Clr, RuntimeArchitecture.x86, ApplicationType.Portable)]
|
||||||
[InlineData(RuntimeFlavor.Clr, RuntimeArchitecture.x64, "http://localhost:5062/", ServerType.Kestrel, ApplicationType.Portable)]
|
[InlineData(RuntimeFlavor.Clr, RuntimeArchitecture.x64, ApplicationType.Portable)]
|
||||||
public Task HelloWorld_IISExpress(RuntimeFlavor runtimeFlavor, RuntimeArchitecture architecture, string applicationBaseUrl, ServerType delegateServer, ApplicationType applicationType)
|
public Task HelloWorld_IISExpress(RuntimeFlavor runtimeFlavor, RuntimeArchitecture architecture, ApplicationType applicationType)
|
||||||
{
|
{
|
||||||
return HelloWorld(ServerType.IISExpress, runtimeFlavor, architecture, applicationBaseUrl, delegateServer, applicationType);
|
return HelloWorld(ServerType.IISExpress, runtimeFlavor, architecture, applicationType);
|
||||||
}
|
}
|
||||||
|
|
||||||
[ConditionalTheory]
|
[ConditionalTheory]
|
||||||
[OSSkipCondition(OperatingSystems.Linux | OperatingSystems.MacOSX)]
|
[OSSkipCondition(OperatingSystems.Linux | OperatingSystems.MacOSX)]
|
||||||
[FrameworkSkipCondition(RuntimeFrameworks.CLR)]
|
[FrameworkSkipCondition(RuntimeFrameworks.CLR)]
|
||||||
//[InlineData(RuntimeFlavor.CoreClr, RuntimeArchitecture.x86, "http://localhost:5063/", ServerType.Kestrel, ApplicationType.Portable)]
|
//[InlineData(RuntimeFlavor.CoreClr, RuntimeArchitecture.x86, ApplicationType.Portable)]
|
||||||
// TODO reenable when https://github.com/dotnet/sdk/issues/696 is resolved
|
// TODO reenable when https://github.com/dotnet/sdk/issues/696 is resolved
|
||||||
//[InlineData(RuntimeFlavor.CoreClr, RuntimeArchitecture.x64, "http://localhost:5064/", ServerType.Kestrel, ApplicationType.Standalone)]
|
//[InlineData(RuntimeFlavor.CoreClr, RuntimeArchitecture.x64, ApplicationType.Standalone)]
|
||||||
[InlineData(RuntimeFlavor.CoreClr, RuntimeArchitecture.x64, "http://localhost:5065/", ServerType.Kestrel, ApplicationType.Portable)]
|
[InlineData(RuntimeFlavor.CoreClr, RuntimeArchitecture.x64, ApplicationType.Portable)]
|
||||||
public Task HelloWorld_IISExpress_CoreClr(RuntimeFlavor runtimeFlavor, RuntimeArchitecture architecture, string applicationBaseUrl, ServerType delegateServer, ApplicationType applicationType)
|
public Task HelloWorld_IISExpress_CoreClr(RuntimeFlavor runtimeFlavor, RuntimeArchitecture architecture, ApplicationType applicationType)
|
||||||
{
|
{
|
||||||
return HelloWorld(ServerType.IISExpress, runtimeFlavor, architecture, applicationBaseUrl, delegateServer, applicationType);
|
return HelloWorld(ServerType.IISExpress, runtimeFlavor, architecture, applicationType);
|
||||||
}
|
}
|
||||||
|
|
||||||
[ConditionalTheory]
|
[ConditionalTheory]
|
||||||
[SkipIfEnvironmentVariableNotEnabled("IIS_VARIATIONS_ENABLED")]
|
[SkipIfEnvironmentVariableNotEnabled("IIS_VARIATIONS_ENABLED")]
|
||||||
[OSSkipCondition(OperatingSystems.Linux | OperatingSystems.MacOSX)]
|
[OSSkipCondition(OperatingSystems.Linux | OperatingSystems.MacOSX)]
|
||||||
[FrameworkSkipCondition(RuntimeFrameworks.CoreCLR)]
|
[FrameworkSkipCondition(RuntimeFrameworks.CoreCLR)]
|
||||||
[InlineData(RuntimeFlavor.Clr, RuntimeArchitecture.x64, "http://localhost:5069/", ServerType.Kestrel, ApplicationType.Portable)]
|
[InlineData(RuntimeFlavor.Clr, RuntimeArchitecture.x64, ApplicationType.Portable)]
|
||||||
//[InlineData(RuntimeFlavor.CoreClr, RuntimeArchitecture.x86, "http://localhost:5070/", ServerType.Kestrel, ApplicationType.Standalone)]
|
//[InlineData(RuntimeFlavor.CoreClr, RuntimeArchitecture.x86, ApplicationType.Standalone)]
|
||||||
public Task HelloWorld_IIS(RuntimeFlavor runtimeFlavor, RuntimeArchitecture architecture, string applicationBaseUrl, ServerType delegateServer, ApplicationType applicationType)
|
public Task HelloWorld_IIS(RuntimeFlavor runtimeFlavor, RuntimeArchitecture architecture, ApplicationType applicationType)
|
||||||
{
|
{
|
||||||
return HelloWorld(ServerType.IIS, runtimeFlavor, architecture, applicationBaseUrl, delegateServer, applicationType);
|
return HelloWorld(ServerType.IIS, runtimeFlavor, architecture, applicationType);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task HelloWorld(ServerType serverType, RuntimeFlavor runtimeFlavor, RuntimeArchitecture architecture, string applicationBaseUrl, ServerType delegateServer, ApplicationType applicationType)
|
public async Task HelloWorld(ServerType serverType, RuntimeFlavor runtimeFlavor, RuntimeArchitecture architecture, ApplicationType applicationType)
|
||||||
{
|
{
|
||||||
var logger = new LoggerFactory()
|
var loggerFactory = new LoggerFactory()
|
||||||
.AddConsole()
|
.AddXunit(_output)
|
||||||
.AddDebug()
|
.AddDebug();
|
||||||
.CreateLogger($"HelloWorld:{serverType}:{runtimeFlavor}:{architecture}:{delegateServer}");
|
var logger = loggerFactory.CreateLogger($"HelloWorld:{serverType}:{runtimeFlavor}:{architecture}");
|
||||||
|
|
||||||
using (logger.BeginScope("HelloWorldTest"))
|
using (logger.BeginScope("HelloWorldTest"))
|
||||||
{
|
{
|
||||||
var deploymentParameters = new DeploymentParameters(Helpers.GetTestSitesPath(), serverType, runtimeFlavor, architecture)
|
var deploymentParameters = new DeploymentParameters(Helpers.GetTestSitesPath(), serverType, runtimeFlavor, architecture)
|
||||||
{
|
{
|
||||||
ApplicationBaseUriHint = applicationBaseUrl,
|
|
||||||
EnvironmentName = "HelloWorld", // Will pick the Start class named 'StartupHelloWorld',
|
EnvironmentName = "HelloWorld", // Will pick the Start class named 'StartupHelloWorld',
|
||||||
ServerConfigTemplateContent = (serverType == ServerType.IISExpress) ? File.ReadAllText("Http.config") : null,
|
ServerConfigTemplateContent = (serverType == ServerType.IISExpress) ? File.ReadAllText("Http.config") : null,
|
||||||
SiteName = "HttpTestSite", // This is configured in the Http.config
|
SiteName = "HttpTestSite", // This is configured in the Http.config
|
||||||
|
|
@ -68,9 +74,9 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
|
||||||
ApplicationType = applicationType
|
ApplicationType = applicationType
|
||||||
};
|
};
|
||||||
|
|
||||||
using (var deployer = ApplicationDeployerFactory.Create(deploymentParameters, logger))
|
using (var deployer = ApplicationDeployerFactory.Create(deploymentParameters, loggerFactory))
|
||||||
{
|
{
|
||||||
var deploymentResult = deployer.Deploy();
|
var deploymentResult = await deployer.DeployAsync();
|
||||||
var httpClientHandler = new HttpClientHandler();
|
var httpClientHandler = new HttpClientHandler();
|
||||||
var httpClient = new HttpClient(httpClientHandler)
|
var httpClient = new HttpClient(httpClientHandler)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) .NET Foundation. All rights reserved.
|
// Copyright (c) .NET Foundation. All rights reserved.
|
||||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
|
@ -11,7 +11,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
|
||||||
public static string GetTestSitesPath()
|
public static string GetTestSitesPath()
|
||||||
{
|
{
|
||||||
return Path.GetFullPath(
|
return Path.GetFullPath(
|
||||||
Path.Combine(AppDomain.CurrentDomain.BaseDirectory,
|
Path.Combine(AppDomain.CurrentDomain.BaseDirectory,
|
||||||
"..", // tfm
|
"..", // tfm
|
||||||
"..", // debug
|
"..", // debug
|
||||||
"..", // obj
|
"..", // obj
|
||||||
|
|
|
||||||
|
|
@ -14,9 +14,18 @@ using Xunit.Sdk;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
|
namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
|
||||||
{
|
{
|
||||||
// IisExpress preregisteres 44300-44399 ports.
|
// IIS Express preregisteres 44300-44399 ports with SSL bindings.
|
||||||
|
// So these tests always have to use ports in this range, and we can't rely on OS-allocated ports without a whole lot of ceremony around
|
||||||
|
// creating self-signed certificates and registering SSL bindings with HTTP.sys
|
||||||
public class HttpsTest
|
public class HttpsTest
|
||||||
{
|
{
|
||||||
|
private readonly ITestOutputHelper _output;
|
||||||
|
|
||||||
|
public HttpsTest(ITestOutputHelper output)
|
||||||
|
{
|
||||||
|
_output = output;
|
||||||
|
}
|
||||||
|
|
||||||
[ConditionalTheory]
|
[ConditionalTheory]
|
||||||
[OSSkipCondition(OperatingSystems.Linux | OperatingSystems.MacOSX)]
|
[OSSkipCondition(OperatingSystems.Linux | OperatingSystems.MacOSX)]
|
||||||
[FrameworkSkipCondition(RuntimeFrameworks.CoreCLR)]
|
[FrameworkSkipCondition(RuntimeFrameworks.CoreCLR)]
|
||||||
|
|
@ -39,10 +48,10 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
|
||||||
|
|
||||||
public async Task HttpsHelloWorld(ServerType serverType, RuntimeFlavor runtimeFlavor, RuntimeArchitecture architecture, string applicationBaseUrl, ApplicationType applicationType)
|
public async Task HttpsHelloWorld(ServerType serverType, RuntimeFlavor runtimeFlavor, RuntimeArchitecture architecture, string applicationBaseUrl, ApplicationType applicationType)
|
||||||
{
|
{
|
||||||
var logger = new LoggerFactory()
|
var loggerFactory = new LoggerFactory()
|
||||||
.AddConsole()
|
.AddConsole()
|
||||||
.AddDebug()
|
.AddDebug();
|
||||||
.CreateLogger($"HttpsHelloWorld:{serverType}:{runtimeFlavor}:{architecture}");
|
var logger = loggerFactory.CreateLogger($"HttpsHelloWorld:{serverType}:{runtimeFlavor}:{architecture}");
|
||||||
|
|
||||||
using (logger.BeginScope("HttpsHelloWorldTest"))
|
using (logger.BeginScope("HttpsHelloWorldTest"))
|
||||||
{
|
{
|
||||||
|
|
@ -56,9 +65,9 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
|
||||||
ApplicationType = applicationType
|
ApplicationType = applicationType
|
||||||
};
|
};
|
||||||
|
|
||||||
using (var deployer = ApplicationDeployerFactory.Create(deploymentParameters, logger))
|
using (var deployer = ApplicationDeployerFactory.Create(deploymentParameters, loggerFactory))
|
||||||
{
|
{
|
||||||
var deploymentResult = deployer.Deploy();
|
var deploymentResult = await deployer.DeployAsync();
|
||||||
var handler = new HttpClientHandler();
|
var handler = new HttpClientHandler();
|
||||||
handler.ServerCertificateCustomValidationCallback = (a, b, c, d) => true;
|
handler.ServerCertificateCustomValidationCallback = (a, b, c, d) => true;
|
||||||
var httpClient = new HttpClient(handler)
|
var httpClient = new HttpClient(handler)
|
||||||
|
|
@ -111,7 +120,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
|
||||||
[ConditionalTheory(Skip = "Manual test only, selecting a client cert is non-determanistic on different machines.")]
|
[ConditionalTheory(Skip = "Manual test only, selecting a client cert is non-determanistic on different machines.")]
|
||||||
[OSSkipCondition(OperatingSystems.Linux | OperatingSystems.MacOSX)]
|
[OSSkipCondition(OperatingSystems.Linux | OperatingSystems.MacOSX)]
|
||||||
[FrameworkSkipCondition(RuntimeFrameworks.CoreCLR)]
|
[FrameworkSkipCondition(RuntimeFrameworks.CoreCLR)]
|
||||||
[InlineData(RuntimeFlavor.Clr, RuntimeArchitecture.x64, "https://localhost:44401/", ApplicationType.Portable)]
|
[InlineData(RuntimeFlavor.Clr, RuntimeArchitecture.x64, "https://localhost:44301/", ApplicationType.Portable)]
|
||||||
public Task Https_HelloWorld_ClientCert(RuntimeFlavor runtimeFlavor, RuntimeArchitecture architecture, string applicationBaseUrl, ApplicationType applicationType)
|
public Task Https_HelloWorld_ClientCert(RuntimeFlavor runtimeFlavor, RuntimeArchitecture architecture, string applicationBaseUrl, ApplicationType applicationType)
|
||||||
{
|
{
|
||||||
return HttpsHelloWorldCerts(ServerType.IISExpress, runtimeFlavor, architecture, applicationBaseUrl, applicationType, sendClientCert: true);
|
return HttpsHelloWorldCerts(ServerType.IISExpress, runtimeFlavor, architecture, applicationBaseUrl, applicationType, sendClientCert: true);
|
||||||
|
|
@ -120,7 +129,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
|
||||||
[ConditionalTheory(Skip = "Manual test only, selecting a client cert is non-determanistic on different machines.")]
|
[ConditionalTheory(Skip = "Manual test only, selecting a client cert is non-determanistic on different machines.")]
|
||||||
[OSSkipCondition(OperatingSystems.Linux | OperatingSystems.MacOSX)]
|
[OSSkipCondition(OperatingSystems.Linux | OperatingSystems.MacOSX)]
|
||||||
[FrameworkSkipCondition(RuntimeFrameworks.CLR)]
|
[FrameworkSkipCondition(RuntimeFrameworks.CLR)]
|
||||||
//[InlineData(RuntimeFlavor.CoreClr, RuntimeArchitecture.x86, "https://localhost:44400/", ApplicationType.Standalone)]
|
//[InlineData(RuntimeFlavor.CoreClr, RuntimeArchitecture.x86, "https://localhost:44302/", ApplicationType.Standalone)]
|
||||||
public Task Https_HelloWorld_ClientCert_CoreCLR(RuntimeFlavor runtimeFlavor, RuntimeArchitecture architecture, string applicationBaseUrl, ApplicationType applicationType)
|
public Task Https_HelloWorld_ClientCert_CoreCLR(RuntimeFlavor runtimeFlavor, RuntimeArchitecture architecture, string applicationBaseUrl, ApplicationType applicationType)
|
||||||
{
|
{
|
||||||
return HttpsHelloWorldCerts(ServerType.IISExpress, runtimeFlavor, architecture, applicationBaseUrl, applicationType, sendClientCert: true);
|
return HttpsHelloWorldCerts(ServerType.IISExpress, runtimeFlavor, architecture, applicationBaseUrl, applicationType, sendClientCert: true);
|
||||||
|
|
@ -128,10 +137,10 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
|
||||||
|
|
||||||
public async Task HttpsHelloWorldCerts(ServerType serverType, RuntimeFlavor runtimeFlavor, RuntimeArchitecture architecture, string applicationBaseUrl, ApplicationType applicationType, bool sendClientCert)
|
public async Task HttpsHelloWorldCerts(ServerType serverType, RuntimeFlavor runtimeFlavor, RuntimeArchitecture architecture, string applicationBaseUrl, ApplicationType applicationType, bool sendClientCert)
|
||||||
{
|
{
|
||||||
Console.WriteLine("Running test");
|
var loggerFactory = new LoggerFactory()
|
||||||
var logger = new LoggerFactory()
|
.AddXunit(_output)
|
||||||
.AddConsole()
|
.AddDebug();
|
||||||
.CreateLogger($"HttpsHelloWorldCerts:{serverType}:{runtimeFlavor}:{architecture}");
|
var logger = loggerFactory.CreateLogger($"HttpsHelloWorldCerts:{serverType}:{runtimeFlavor}:{architecture}");
|
||||||
|
|
||||||
using (logger.BeginScope("HttpsHelloWorldTest"))
|
using (logger.BeginScope("HttpsHelloWorldTest"))
|
||||||
{
|
{
|
||||||
|
|
@ -145,9 +154,9 @@ Console.WriteLine("Running test");
|
||||||
ApplicationType = applicationType
|
ApplicationType = applicationType
|
||||||
};
|
};
|
||||||
|
|
||||||
using (var deployer = ApplicationDeployerFactory.Create(deploymentParameters, logger))
|
using (var deployer = ApplicationDeployerFactory.Create(deploymentParameters, loggerFactory))
|
||||||
{
|
{
|
||||||
var deploymentResult = deployer.Deploy();
|
var deploymentResult = await deployer.DeployAsync();
|
||||||
var handler = new HttpClientHandler();
|
var handler = new HttpClientHandler();
|
||||||
handler.ServerCertificateCustomValidationCallback = (a, b, c, d) => true;
|
handler.ServerCertificateCustomValidationCallback = (a, b, c, d) => true;
|
||||||
handler.ClientCertificateOptions = ClientCertificateOption.Manual;
|
handler.ClientCertificateOptions = ClientCertificateOption.Manual;
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,6 @@ using Xunit.Abstractions;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
|
namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
|
||||||
{
|
{
|
||||||
// Uses ports ranging 5050 - 5060.
|
|
||||||
public class NtlmAuthenticationTests
|
public class NtlmAuthenticationTests
|
||||||
{
|
{
|
||||||
private readonly ITestOutputHelper _output;
|
private readonly ITestOutputHelper _output;
|
||||||
|
|
@ -29,28 +28,29 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
|
||||||
[ConditionalTheory]
|
[ConditionalTheory]
|
||||||
[OSSkipCondition(OperatingSystems.Linux | OperatingSystems.MacOSX)]
|
[OSSkipCondition(OperatingSystems.Linux | OperatingSystems.MacOSX)]
|
||||||
[FrameworkSkipCondition(RuntimeFrameworks.CoreCLR)]
|
[FrameworkSkipCondition(RuntimeFrameworks.CoreCLR)]
|
||||||
[InlineData(RuntimeFlavor.Clr, RuntimeArchitecture.x64, "http://localhost:5051/", ApplicationType.Portable)]
|
[InlineData(RuntimeFlavor.Clr, RuntimeArchitecture.x64, ApplicationType.Portable)]
|
||||||
public Task NtlmAuthentication(RuntimeFlavor runtimeFlavor, RuntimeArchitecture architecture, string applicationBaseUrl, ApplicationType applicationType)
|
public Task NtlmAuthentication(RuntimeFlavor runtimeFlavor, RuntimeArchitecture architecture, ApplicationType applicationType)
|
||||||
{
|
{
|
||||||
return NtlmAuthentication(ServerType.IISExpress, runtimeFlavor, architecture, applicationBaseUrl, applicationType);
|
return NtlmAuthentication(ServerType.IISExpress, runtimeFlavor, architecture, applicationType);
|
||||||
}
|
}
|
||||||
|
|
||||||
[ConditionalTheory(Skip = "No test configuration enabled")]
|
[ConditionalTheory(Skip = "No test configuration enabled")]
|
||||||
[OSSkipCondition(OperatingSystems.Linux | OperatingSystems.MacOSX)]
|
[OSSkipCondition(OperatingSystems.Linux | OperatingSystems.MacOSX)]
|
||||||
[FrameworkSkipCondition(RuntimeFrameworks.CLR)]
|
[FrameworkSkipCondition(RuntimeFrameworks.CLR)]
|
||||||
//[InlineData(RuntimeFlavor.CoreClr, RuntimeArchitecture.x86, "http://localhost:5050/", ApplicationType.Standalone)]
|
//[InlineData(RuntimeFlavor.CoreClr, RuntimeArchitecture.x86, ApplicationType.Standalone)]
|
||||||
// TODO reenable when https://github.com/dotnet/sdk/issues/696 is resolved
|
// TODO reenable when https://github.com/dotnet/sdk/issues/696 is resolved
|
||||||
//[InlineData(RuntimeFlavor.CoreClr, RuntimeArchitecture.x64, "http://localhost:5052/", ApplicationType.Standalone)]
|
//[InlineData(RuntimeFlavor.CoreClr, RuntimeArchitecture.x64, ApplicationType.Standalone)]
|
||||||
public Task NtlmAuthentication_CoreCLR(RuntimeFlavor runtimeFlavor, RuntimeArchitecture architecture, string applicationBaseUrl, ApplicationType applicationType)
|
public Task NtlmAuthentication_CoreCLR(RuntimeFlavor runtimeFlavor, RuntimeArchitecture architecture, ApplicationType applicationType)
|
||||||
{
|
{
|
||||||
return NtlmAuthentication(ServerType.IISExpress, runtimeFlavor, architecture, applicationBaseUrl, applicationType);
|
return NtlmAuthentication(ServerType.IISExpress, runtimeFlavor, architecture, applicationType);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task NtlmAuthentication(ServerType serverType, RuntimeFlavor runtimeFlavor, RuntimeArchitecture architecture, string applicationBaseUrl, ApplicationType applicationType)
|
public async Task NtlmAuthentication(ServerType serverType, RuntimeFlavor runtimeFlavor, RuntimeArchitecture architecture, ApplicationType applicationType)
|
||||||
{
|
{
|
||||||
var factory = new LoggerFactory().AddDebug();
|
var loggerFactory = new LoggerFactory()
|
||||||
factory.AddProvider(new XunitLoggerProvider(_output));
|
.AddXunit(_output)
|
||||||
var logger = factory.CreateLogger($"NtlmAuthentication:{serverType}:{runtimeFlavor}:{architecture}");
|
.AddDebug();
|
||||||
|
var logger = loggerFactory.CreateLogger($"NtlmAuthentication:{serverType}:{runtimeFlavor}:{architecture}");
|
||||||
|
|
||||||
using (logger.BeginScope("NtlmAuthenticationTest"))
|
using (logger.BeginScope("NtlmAuthenticationTest"))
|
||||||
{
|
{
|
||||||
|
|
@ -60,7 +60,6 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
|
||||||
|
|
||||||
var deploymentParameters = new DeploymentParameters(Helpers.GetTestSitesPath(), serverType, runtimeFlavor, architecture)
|
var deploymentParameters = new DeploymentParameters(Helpers.GetTestSitesPath(), serverType, runtimeFlavor, architecture)
|
||||||
{
|
{
|
||||||
ApplicationBaseUriHint = applicationBaseUrl,
|
|
||||||
EnvironmentName = "NtlmAuthentication", // Will pick the Start class named 'StartupNtlmAuthentication'
|
EnvironmentName = "NtlmAuthentication", // Will pick the Start class named 'StartupNtlmAuthentication'
|
||||||
ServerConfigTemplateContent = (serverType == ServerType.IISExpress) ? File.ReadAllText("NtlmAuthentation.config") : null,
|
ServerConfigTemplateContent = (serverType == ServerType.IISExpress) ? File.ReadAllText("NtlmAuthentation.config") : null,
|
||||||
SiteName = "NtlmAuthenticationTestSite", // This is configured in the NtlmAuthentication.config
|
SiteName = "NtlmAuthenticationTestSite", // This is configured in the NtlmAuthentication.config
|
||||||
|
|
@ -71,9 +70,9 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
|
||||||
: null
|
: null
|
||||||
};
|
};
|
||||||
|
|
||||||
using (var deployer = ApplicationDeployerFactory.Create(deploymentParameters, logger))
|
using (var deployer = ApplicationDeployerFactory.Create(deploymentParameters, loggerFactory))
|
||||||
{
|
{
|
||||||
var deploymentResult = deployer.Deploy();
|
var deploymentResult = await deployer.DeployAsync();
|
||||||
var httpClientHandler = new HttpClientHandler();
|
var httpClientHandler = new HttpClientHandler();
|
||||||
var httpClient = new HttpClient(httpClientHandler)
|
var httpClient = new HttpClient(httpClientHandler)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,52 +0,0 @@
|
||||||
// Copyright (c) .NET Foundation. All rights reserved.
|
|
||||||
// See License.txt in the project root for license information
|
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Linq;
|
|
||||||
using Microsoft.Extensions.Logging;
|
|
||||||
using Xunit.Abstractions;
|
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Testing
|
|
||||||
{
|
|
||||||
public class XunitLogger : ILogger, IDisposable
|
|
||||||
{
|
|
||||||
private readonly ITestOutputHelper _output;
|
|
||||||
private readonly string _categoryName;
|
|
||||||
|
|
||||||
public XunitLogger(ITestOutputHelper output, string categoryName)
|
|
||||||
{;
|
|
||||||
_output = output;
|
|
||||||
_categoryName = categoryName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Log<TState>(
|
|
||||||
LogLevel logLevel, EventId eventId, TState state, Exception exception, Func<TState, Exception, string> formatter)
|
|
||||||
{
|
|
||||||
var firstLinePrefix = $"| {logLevel} [{_categoryName}]: ";
|
|
||||||
var lines = formatter(state, exception).Split('\n');
|
|
||||||
_output.WriteLine(firstLinePrefix + lines.First());
|
|
||||||
|
|
||||||
var additionalLinePrefix = "|" + new string(' ', firstLinePrefix.Length - 1);
|
|
||||||
foreach (var line in lines.Skip(1))
|
|
||||||
{
|
|
||||||
_output.WriteLine(additionalLinePrefix + line.Trim('\r'));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool IsEnabled(LogLevel logLevel) => true;
|
|
||||||
|
|
||||||
public IDisposable BeginScope<TState>(TState state)
|
|
||||||
=> new NullScope();
|
|
||||||
|
|
||||||
private class NullScope : IDisposable
|
|
||||||
{
|
|
||||||
public void Dispose()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Dispose()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,26 +0,0 @@
|
||||||
// Copyright (c) .NET Foundation. All rights reserved.
|
|
||||||
// See License.txt in the project root for license information
|
|
||||||
|
|
||||||
using Microsoft.Extensions.Logging;
|
|
||||||
using Xunit.Abstractions;
|
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Testing
|
|
||||||
{
|
|
||||||
class XunitLoggerProvider : ILoggerProvider
|
|
||||||
{
|
|
||||||
private readonly ITestOutputHelper _output;
|
|
||||||
|
|
||||||
public XunitLoggerProvider(ITestOutputHelper output)
|
|
||||||
{
|
|
||||||
_output = output;
|
|
||||||
}
|
|
||||||
public ILogger CreateLogger(string categoryName)
|
|
||||||
{
|
|
||||||
return new XunitLogger(_output, categoryName);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Dispose()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Loading…
Reference in New Issue