React to IntegrationTesting changes

This commit is contained in:
Chris Ross (ASP.NET) 2018-05-11 10:15:34 -07:00
parent 533e464712
commit 63c00b3c68
23 changed files with 105 additions and 270 deletions

View File

@ -42,6 +42,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{7E80C58E
build\Key.snk = build\Key.snk
build\native.targets = build\native.targets
build\repo.props = build\repo.props
build\sources.props = build\sources.props
build\testsite.props = build\testsite.props
EndProjectSection
EndProject

View File

@ -1,10 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<!-- Using shorter assembly name instead of Microsoft.AspNetCore.Server.Kestrel.Performance because https://github.com/dotnet/BenchmarkDotNet/issues/498 -->
<AssemblyName>IIS.Performance</AssemblyName>
<RootNamespace>Microsoft.AspNetCore.Server.IIS.Performance</RootNamespace>
<TargetFramework>netcoreapp2.1</TargetFramework>
<TargetFramework>netcoreapp2.2</TargetFramework>
<OutputType>Exe</OutputType>
<ServerGarbageCollection>true</ServerGarbageCollection>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>

View File

@ -1,10 +1,8 @@
// 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.
using System;
using System.IO;
using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Running;
@ -17,7 +15,7 @@ namespace Microsoft.AspNetCore.Server.IIS.Performance
[AspNetCoreBenchmark(typeof(FirstRequestConfig))]
public class StartupTimeBenchmark
{
private IApplicationDeployer _deployer;
private ApplicationDeployer _deployer;
public HttpClient _client;
[IterationSetup]
@ -32,7 +30,7 @@ namespace Microsoft.AspNetCore.Server.IIS.Performance
SiteName = "HttpTestSite",
TargetFramework = "netcoreapp2.1",
ApplicationType = ApplicationType.Portable,
ANCMVersion = ANCMVersion.AspNetCoreModuleV2
AncmVersion = AncmVersion.AspNetCoreModuleV2
};
_deployer = ApplicationDeployerFactory.Create(deploymentParameters, NullLoggerFactory.Instance);
_client = _deployer.DeployAsync().Result.HttpClient;

View File

@ -1,4 +1,4 @@
<Project>
<Project>
<PropertyGroup>
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
</PropertyGroup>
@ -14,7 +14,7 @@
<MicrosoftAspNetCoreHttpOverridesPackageVersion>2.2.0-preview1-34217</MicrosoftAspNetCoreHttpOverridesPackageVersion>
<MicrosoftAspNetCoreHttpPackageVersion>2.2.0-preview1-34217</MicrosoftAspNetCoreHttpPackageVersion>
<MicrosoftAspNetCoreHttpSysSourcesPackageVersion>2.2.0-preview1-34217</MicrosoftAspNetCoreHttpSysSourcesPackageVersion>
<MicrosoftAspNetCoreServerIntegrationTestingPackageVersion>0.6.0-preview1-34217</MicrosoftAspNetCoreServerIntegrationTestingPackageVersion>
<MicrosoftAspNetCoreServerIntegrationTestingPackageVersion>0.6.0-a-preview1-inttesting-17031</MicrosoftAspNetCoreServerIntegrationTestingPackageVersion>
<MicrosoftAspNetCoreServerKestrelPackageVersion>2.2.0-preview1-34217</MicrosoftAspNetCoreServerKestrelPackageVersion>
<MicrosoftAspNetCoreTestHostPackageVersion>2.2.0-preview1-34217</MicrosoftAspNetCoreTestHostPackageVersion>
<MicrosoftAspNetCoreTestingPackageVersion>2.2.0-preview1-34217</MicrosoftAspNetCoreTestingPackageVersion>

View File

@ -19,8 +19,6 @@
<PackageReference Include="Microsoft.AspNetCore.Server.IntegrationTesting" Version="$(MicrosoftAspNetCoreServerIntegrationTestingPackageVersion)" />
<PackageReference Include="Microsoft.Extensions.CommandLineUtils.Sources" Version="$(MicrosoftExtensionsCommandLineUtilsSourcesPackageVersion)" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="$(MicrosoftExtensionsLoggingPackageVersion)" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="$(MicrosoftExtensionsLoggingConsolePackageVersion)" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="$(MicrosoftExtensionsLoggingDebugPackageVersion)" />
<PackageReference Include="Microsoft.Extensions.Logging.Testing" Version="$(MicrosoftExtensionsLoggingTestingPackageVersion)" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="$(MicrosoftNETTestSdkPackageVersion)" />
<PackageReference Include="System.Net.WebSockets.WebSocketProtocol" Version="$(SystemNetWebSocketsWebSocketProtocolPackageVersion)" />

View File

@ -1,17 +1,17 @@
// 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.
#if NET461
using System.Net;
using System.Net.Http;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Testing.xunit;
using Microsoft.AspNetCore.Server.IntegrationTesting;
using Xunit;
namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
{
[Collection(IISTestSiteCollection.Name)]
[SkipIfIISExpressSchemaMissingInProcess]
public class AuthenticationTests
{
private readonly IISTestSiteFixture _fixture;
@ -21,7 +21,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
}
[ConditionalFact]
public async Task Authentication_InProcess_IISExpressAsync()
public async Task Authentication_InProcess()
{
var response = await _fixture.Client.GetAsync("/AuthenticationAnonymous");
@ -61,7 +61,3 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
}
}
}
#elif NETCOREAPP2_1
#else
#error Target frameworks need to be updated
#endif

View File

@ -2,12 +2,14 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Threading.Tasks;
using Microsoft.AspNetCore.Server.IntegrationTesting;
using Microsoft.AspNetCore.Testing.xunit;
using Xunit;
namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
{
[Collection(IISTestSiteCollection.Name)]
[SkipIfIISExpressSchemaMissingInProcess]
public class EnvironmentVariableTests
{
private readonly IISTestSiteFixture _fixture;

View File

@ -3,12 +3,14 @@
using System.Threading;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Server.IntegrationTesting;
using Microsoft.AspNetCore.Testing.xunit;
using Xunit;
namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
{
[Collection(IISTestSiteCollection.Name)]
[SkipIfIISExpressSchemaMissingInProcess]
public class FeatureCollectionTest
{
private readonly IISTestSiteFixture _fixture;

View File

@ -3,12 +3,14 @@
using System.Threading;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Server.IntegrationTesting;
using Microsoft.AspNetCore.Testing.xunit;
using Xunit;
namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
{
[Collection(IISTestSiteCollection.Name)]
[SkipIfIISExpressSchemaMissingInProcess]
public class HelloWorldInProcessTests
{
private readonly IISTestSiteFixture _fixture;
@ -19,7 +21,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
}
[ConditionalFact]
public async Task HelloWorld_InProcess_IISExpress_CoreClr_X64_Portable()
public async Task HelloWorld_InProcess()
{
Assert.Equal("Hello World", await _fixture.Client.GetStringAsync("/HelloWorld"));

View File

@ -3,12 +3,14 @@
using System.Net.Http;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Server.IntegrationTesting;
using Microsoft.AspNetCore.Testing.xunit;
using Xunit;
namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
{
[Collection(IISTestSiteCollection.Name)]
[SkipIfIISExpressSchemaMissingInProcess]
public class InvalidReadWriteOperationTests
{
private readonly IISTestSiteFixture _fixture;

View File

@ -2,12 +2,14 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Threading.Tasks;
using Microsoft.AspNetCore.Server.IntegrationTesting;
using Microsoft.AspNetCore.Testing.xunit;
using Xunit;
namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
{
[Collection(IISTestSiteCollection.Name)]
[SkipIfIISExpressSchemaMissingInProcess]
public class LargeResponseBodyTests
{
private readonly IISTestSiteFixture _fixture;

View File

@ -4,6 +4,7 @@
using System.Linq;
using System.Net;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Server.IntegrationTesting;
using Microsoft.AspNetCore.Testing.xunit;
using Microsoft.Net.Http.Headers;
using Xunit;
@ -11,7 +12,7 @@ using Xunit;
namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
{
[Collection(IISTestSiteCollection.Name)]
[SkipIfIISExpressSchemaMissingInProcess]
public class ResponseHeaders
{
private readonly IISTestSiteFixture _fixture;

View File

@ -2,12 +2,14 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Threading.Tasks;
using Microsoft.AspNetCore.Server.IntegrationTesting;
using Microsoft.AspNetCore.Testing.xunit;
using Xunit;
namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
{
[Collection(IISTestSiteCollection.Name)]
[SkipIfIISExpressSchemaMissingInProcess]
public class ResponseInvalidOrderingTest
{
private readonly IISTestSiteFixture _fixture;

View File

@ -2,12 +2,14 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Threading.Tasks;
using Microsoft.AspNetCore.Server.IntegrationTesting;
using Microsoft.AspNetCore.Testing.xunit;
using Xunit;
namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
{
[Collection(IISTestSiteCollection.Name)]
[SkipIfIISExpressSchemaMissingInProcess]
public class ServerVariablesTest
{
private readonly IISTestSiteFixture _fixture;

View File

@ -15,6 +15,7 @@ using Xunit.Sdk;
namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
{
[SkipIfIISExpressSchemaMissingInProcess]
public class StartupTests : LoggedTest
{
public StartupTests(ITestOutputHelper output) : base(output)
@ -25,12 +26,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
[Fact]
public async Task ExpandEnvironmentVariableInWebConfig()
{
#if NET461
// use the dotnet on PATH
var dotnetLocation = "dotnet";
#else
var dotnetLocation = DotNetMuxer.MuxerPathOrDefault();
#endif
using (StartLog(out var loggerFactory))
{
var logger = loggerFactory.CreateLogger("HelloWorldTest");
@ -96,9 +92,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
}
}
#if NETCOREAPP2_1
[Fact] // Consistently fails on CI for net461
[Fact]
public async Task StandaloneApplication_ExpectCorrectPublish()
{
using (StartLog(out var loggerFactory))
@ -133,7 +127,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
}
}
[Fact] // Consistently fails on CI for net461
[Fact]
public async Task StandaloneApplication_AbsolutePathToExe_ExpectCorrectPublish()
{
using (StartLog(out var loggerFactory))
@ -170,11 +164,6 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
}
}
#elif NET461
#else
#error Target frameworks need to be updated
#endif
[Fact]
public async Task DetectsOveriddenServer()
{
@ -200,9 +189,9 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
{
ServerConfigTemplateContent = File.ReadAllText("AppHostConfig/Http.config"),
SiteName = "HttpTestSite", // This is configured in the Http.config
TargetFramework = "netcoreapp2.1",
TargetFramework = Tfm.NetCoreApp22,
ApplicationType = ApplicationType.Portable,
ANCMVersion = ANCMVersion.AspNetCoreModuleV2
AncmVersion = AncmVersion.AspNetCoreModuleV2
};
}

View File

@ -6,12 +6,14 @@ using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Server.IntegrationTesting;
using Microsoft.AspNetCore.Testing.xunit;
using Xunit;
namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
{
[Collection(IISTestSiteCollection.Name)]
[SkipIfIISExpressSchemaMissingInProcess]
public class SynchronousReadAndWriteTests
{
private readonly IISTestSiteFixture _fixture;

View File

@ -1,10 +1,10 @@
// 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.
#if NETCOREAPP2_1
using System.IO;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Server.IntegrationTesting;
using Microsoft.AspNetCore.Testing.xunit;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Testing;
using Xunit;
@ -19,47 +19,27 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
{
}
[Theory]
[InlineData(ANCMVersion.AspNetCoreModule)]
[InlineData(ANCMVersion.AspNetCoreModuleV2)]
public Task HelloWorld_IISExpress_Clr_X64_Portable(ANCMVersion ancmVersion)
{
return HelloWorld(RuntimeFlavor.Clr, ApplicationType.Portable, ancmVersion);
}
public static TestMatrix TestVariants
=> TestMatrix.ForServers(ServerType.IISExpress)
.WithTfms(Tfm.NetCoreApp22, Tfm.Net461)
.WithAllApplicationTypes()
.WithAllAncmVersions();
[Theory]
[InlineData(ANCMVersion.AspNetCoreModule)]
[InlineData(ANCMVersion.AspNetCoreModuleV2)]
public Task HelloWorld_IISExpress_CoreClr_X64_Portable(ANCMVersion ancmVersion)
[ConditionalTheory]
[MemberData(nameof(TestVariants))]
public async Task HelloWorld(TestVariant variant)
{
return HelloWorld(RuntimeFlavor.CoreClr, ApplicationType.Portable, ancmVersion);
}
[Theory]
[InlineData(ANCMVersion.AspNetCoreModule)]
[InlineData(ANCMVersion.AspNetCoreModuleV2)]
public Task HelloWorld_IISExpress_CoreClr_X64_Standalone(ANCMVersion ancmVersion)
{
return HelloWorld(RuntimeFlavor.CoreClr, ApplicationType.Standalone, ancmVersion);
}
private async Task HelloWorld(RuntimeFlavor runtimeFlavor, ApplicationType applicationType, ANCMVersion ancmVersion)
{
var serverType = ServerType.IISExpress;
var architecture = RuntimeArchitecture.x64;
var testName = $"HelloWorld_{runtimeFlavor}";
var testName = $"HelloWorld_{variant.Tfm}";
using (StartLog(out var loggerFactory, testName))
{
var logger = loggerFactory.CreateLogger("HelloWorldTest");
var deploymentParameters = new DeploymentParameters(Helpers.GetOutOfProcessTestSitesPath(), serverType, runtimeFlavor, architecture)
var deploymentParameters = new DeploymentParameters(variant)
{
ApplicationPath = Helpers.GetOutOfProcessTestSitesPath(),
EnvironmentName = "HelloWorld", // Will pick the Start class named 'StartupHelloWorld',
ServerConfigTemplateContent = (serverType == ServerType.IISExpress) ? File.ReadAllText("AppHostConfig/Http.config") : null,
ServerConfigTemplateContent = File.ReadAllText("AppHostConfig/Http.config"),
SiteName = "HttpTestSite", // This is configured in the Http.config
TargetFramework = runtimeFlavor == RuntimeFlavor.Clr ? "net461" : "netcoreapp2.1",
ApplicationType = applicationType,
ANCMVersion = ancmVersion
};
using (var deployer = ApplicationDeployerFactory.Create(deploymentParameters, loggerFactory))
@ -107,7 +87,3 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
}
}
}
#elif NET461
#else
#error Target frameworks need to be updated
#endif

View File

@ -1,6 +1,5 @@
// 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.
#if NETCOREAPP2_1
using System;
using System.IO;
@ -8,6 +7,7 @@ using System.Net.Http;
using System.Security.Cryptography.X509Certificates;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Server.IntegrationTesting;
using Microsoft.AspNetCore.Testing.xunit;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Testing;
using Xunit;
@ -25,42 +25,28 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
{
}
[Theory]
[InlineData(ANCMVersion.AspNetCoreModule)]
[InlineData(ANCMVersion.AspNetCoreModuleV2)]
public Task Https_HelloWorld_CLR_X64(ANCMVersion ancmVersion)
{
return HttpsHelloWorld(RuntimeFlavor.Clr, ApplicationType.Portable, port: 44396, ancmVersion);
}
public static TestMatrix TestVariants
=> TestMatrix.ForServers(ServerType.IISExpress)
.WithTfms(Tfm.NetCoreApp22, Tfm.Net461)
.WithAllAncmVersions();
[Theory]
[InlineData(ANCMVersion.AspNetCoreModule)]
[InlineData(ANCMVersion.AspNetCoreModuleV2)]
public Task Https_HelloWorld_CoreCLR_X64_Portable(ANCMVersion ancmVersion)
[ConditionalTheory]
[MemberData(nameof(TestVariants))]
public async Task HttpsHelloWorld(TestVariant variant)
{
return HttpsHelloWorld(RuntimeFlavor.CoreClr, ApplicationType.Portable, port: 44394, ancmVersion);
}
private async Task HttpsHelloWorld(RuntimeFlavor runtimeFlavor, ApplicationType applicationType, int port, ANCMVersion ancmVersion)
{
var serverType = ServerType.IISExpress;
var architecture = RuntimeArchitecture.x64;
var applicationBaseUrl = $"https://localhost:{port}/";
var testName = $"HttpsHelloWorld_{runtimeFlavor}";
var applicationBaseUrl = $"https://localhost:44394/";
var testName = $"HttpsHelloWorld_{variant.Tfm}";
using (StartLog(out var loggerFactory, testName))
{
var logger = loggerFactory.CreateLogger("HttpsHelloWorldTest");
var deploymentParameters = new DeploymentParameters(Helpers.GetOutOfProcessTestSitesPath(), serverType, runtimeFlavor, architecture)
var deploymentParameters = new DeploymentParameters(variant)
{
ApplicationPath = Helpers.GetOutOfProcessTestSitesPath(),
ApplicationBaseUriHint = applicationBaseUrl,
EnvironmentName = "HttpsHelloWorld", // Will pick the Start class named 'StartupHttpsHelloWorld',
ServerConfigTemplateContent = (serverType == ServerType.IISExpress) ? File.ReadAllText("AppHostConfig/Https.config") : null,
ServerConfigTemplateContent = File.ReadAllText("AppHostConfig/Https.config"),
SiteName = "HttpsTestSite", // This is configured in the Https.config
TargetFramework = runtimeFlavor == RuntimeFlavor.Clr ? "net461" : "netcoreapp2.1",
ApplicationType = applicationType,
ANCMVersion = ancmVersion
};
using (var deployer = ApplicationDeployerFactory.Create(deploymentParameters, loggerFactory))
@ -93,61 +79,37 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
}
}
[Theory]
[InlineData(ANCMVersion.AspNetCoreModule)]
[InlineData(ANCMVersion.AspNetCoreModuleV2)]
public Task Https_HelloWorld_NoClientCert_CoreCLR_X64_Portable(ANCMVersion ancmVersion)
[ConditionalTheory]
[MemberData(nameof(TestVariants))]
public Task HttpsHelloWorld_NoClientCert(TestVariant variant)
{
return HttpsHelloWorldCerts(RuntimeFlavor.CoreClr, ApplicationType.Portable, port: 44397, sendClientCert: false, ancmVersion);
}
[Theory]
[InlineData(ANCMVersion.AspNetCoreModule)]
[InlineData(ANCMVersion.AspNetCoreModuleV2)]
public Task Https_HelloWorld_NoClientCert_Clr_X64(ANCMVersion ancmVersion)
{
return HttpsHelloWorldCerts(RuntimeFlavor.Clr, ApplicationType.Portable, port: 44398, sendClientCert: false, ancmVersion);
return HttpsHelloWorldCerts(variant, port: 44397, sendClientCert: false);
}
#pragma warning disable xUnit1004 // Test methods should not be skipped
[Theory(Skip = "Manual test only, selecting a client cert is non-determanistic on different machines.")]
[InlineData(ANCMVersion.AspNetCoreModule)]
[InlineData(ANCMVersion.AspNetCoreModuleV2)]
[ConditionalTheory(Skip = "Manual test only, selecting a client cert is non-determanistic on different machines.")]
[MemberData(nameof(TestVariants))]
#pragma warning restore xUnit1004 // Test methods should not be skipped
public Task Https_HelloWorld_ClientCert_Clr_X64(ANCMVersion ancmVersion)
public Task HttpsHelloWorld_ClientCert(TestVariant variant)
{
return HttpsHelloWorldCerts(RuntimeFlavor.Clr, ApplicationType.Portable, port: 44301, sendClientCert: true, ancmVersion);
return HttpsHelloWorldCerts(variant, port: 44301, sendClientCert: true);
}
#pragma warning disable xUnit1004 // Test methods should not be skipped
[Theory(Skip = "Manual test only, selecting a client cert is non-determanistic on different machines.")]
[InlineData(ANCMVersion.AspNetCoreModule)]
[InlineData(ANCMVersion.AspNetCoreModuleV2)]
#pragma warning restore xUnit1004 // Test methods should not be skipped
public Task Https_HelloWorld_ClientCert_CoreCLR_X64_Portable(ANCMVersion ancmVersion)
private async Task HttpsHelloWorldCerts(TestVariant variant, int port, bool sendClientCert)
{
return HttpsHelloWorldCerts(RuntimeFlavor.CoreClr, ApplicationType.Portable, port: 44302, sendClientCert: true, ancmVersion);
}
private async Task HttpsHelloWorldCerts(RuntimeFlavor runtimeFlavor, ApplicationType applicationType, int port, bool sendClientCert, ANCMVersion ancmVersion)
{
var serverType = ServerType.IISExpress;
var architecture = RuntimeArchitecture.x64;
var applicationBaseUrl = $"https://localhost:{port}/";
var testName = $"HttpsHelloWorldCerts_{runtimeFlavor}";
var testName = $"HttpsHelloWorldCerts_{variant.Tfm}_{sendClientCert}";
using (StartLog(out var loggerFactory, testName))
{
var logger = loggerFactory.CreateLogger("HttpsHelloWorldTest");
var deploymentParameters = new DeploymentParameters(Helpers.GetOutOfProcessTestSitesPath(), serverType, runtimeFlavor, architecture)
var deploymentParameters = new DeploymentParameters(variant)
{
ApplicationPath = Helpers.GetOutOfProcessTestSitesPath(),
ApplicationBaseUriHint = applicationBaseUrl,
EnvironmentName = "HttpsHelloWorld", // Will pick the Start class named 'StartupHttpsHelloWorld',
ServerConfigTemplateContent = (serverType == ServerType.IISExpress) ? File.ReadAllText("AppHostConfig/Https.config") : null,
ServerConfigTemplateContent = File.ReadAllText("AppHostConfig/Https.config"),
SiteName = "HttpsTestSite", // This is configured in the Https.config
TargetFramework = runtimeFlavor == RuntimeFlavor.Clr ? "net461" : "netcoreapp2.1",
ApplicationType = applicationType,
ANCMVersion = ancmVersion
};
using (var deployer = ApplicationDeployerFactory.Create(deploymentParameters, loggerFactory))
@ -230,7 +192,3 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
}
}
}
#elif NET461
#else
#error Target frameworks need to be updated
#endif

View File

@ -1,16 +1,13 @@
// 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.
#if NET461
// Per https://github.com/dotnet/corefx/issues/5045, HttpClientHandler.UseDefaultCredentials does not work correctly in CoreFx.
// We'll require the desktop HttpClient to run these tests.
using System;
using System.IO;
using System.Net;
using System.Net.Http;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Server.IntegrationTesting;
using Microsoft.AspNetCore.Testing.xunit;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Testing;
using Xunit;
@ -25,41 +22,27 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
{
}
[Theory]
[InlineData(ANCMVersion.AspNetCoreModule)]
[InlineData(ANCMVersion.AspNetCoreModuleV2)]
public Task NtlmAuthentication_Clr_X64(ANCMVersion ancmVersion)
{
return NtlmAuthentication(RuntimeFlavor.Clr, ApplicationType.Portable, port: 5051, ancmVersion);
}
public static TestMatrix TestVariants
=> TestMatrix.ForServers(ServerType.IISExpress)
.WithTfms(Tfm.NetCoreApp22, Tfm.Net461)
.WithAllAncmVersions();
[Theory]
[InlineData(ANCMVersion.AspNetCoreModule)]
[InlineData(ANCMVersion.AspNetCoreModuleV2)]
public Task NtlmAuthentication_CoreClr_X64_Portable(ANCMVersion ancmVersion)
[ConditionalTheory]
[MemberData(nameof(TestVariants))]
public async Task NtlmAuthentication(TestVariant variant)
{
return NtlmAuthentication(RuntimeFlavor.CoreClr, ApplicationType.Portable, port: 5052, ancmVersion);
}
private async Task NtlmAuthentication(RuntimeFlavor runtimeFlavor, ApplicationType applicationType, int port, ANCMVersion ancmVersion)
{
var serverType = ServerType.IISExpress;
var architecture = RuntimeArchitecture.x64;
var testName = $"NtlmAuthentication_{runtimeFlavor}";
var testName = $"NtlmAuthentication_{variant.Tfm}_{variant.AncmVersion}";
using (StartLog(out var loggerFactory, testName))
{
var logger = loggerFactory.CreateLogger("NtlmAuthenticationTest");
var deploymentParameters = new DeploymentParameters(Helpers.GetOutOfProcessTestSitesPath(), serverType, runtimeFlavor, architecture)
var deploymentParameters = new DeploymentParameters(variant)
{
ApplicationBaseUriHint = $"http://localhost:{port}",
ApplicationPath = Helpers.GetOutOfProcessTestSitesPath(),
ApplicationBaseUriHint = $"http://localhost:5052",
EnvironmentName = "NtlmAuthentication", // Will pick the Start class named 'StartupNtlmAuthentication'
ServerConfigTemplateContent = (serverType == ServerType.IISExpress) ? File.ReadAllText("AppHostConfig/NtlmAuthentation.config") : null,
ServerConfigTemplateContent = File.ReadAllText("AppHostConfig/NtlmAuthentation.config"),
SiteName = "NtlmAuthenticationTestSite", // This is configured in the NtlmAuthentication.config
TargetFramework = runtimeFlavor == RuntimeFlavor.Clr ? "net461" : "netcoreapp2.1",
ApplicationType = applicationType,
ANCMVersion = ancmVersion,
};
using (var deployer = ApplicationDeployerFactory.Create(deploymentParameters, loggerFactory))
@ -126,7 +109,3 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
}
}
}
#elif NETCOREAPP2_1
#else
#error Target frameworks need to be updated
#endif

View File

@ -4,5 +4,4 @@
// All functional tests in this project require a version of IIS express with an updated schema
using Xunit;
[assembly: Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests.IISExpressSupportsInProcessHosting]
[assembly: CollectionBehavior(DisableTestParallelization = true)]

View File

@ -23,67 +23,52 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
}
[Fact]
public Task UpgradeFeatureDetectionDisabled_InProcess_IISExpress_CoreClr_x64_Portable()
public Task UpgradeFeatureDetectionDisabled_InProcess_IISExpress()
{
return UpgradeFeatureDetectionDeployer(RuntimeFlavor.CoreClr,
ApplicationType.Portable,
"AppHostConfig/WebsocketsNotSupported.config",
return UpgradeFeatureDetectionDeployer("AppHostConfig/WebsocketsNotSupported.config",
Helpers.GetInProcessTestSitesPath(),
"Disabled");
}
[Fact]
public Task UpgradeFeatureDetectionEnabled_InProcess_IISExpress_CoreClr_x64_Portable()
public Task UpgradeFeatureDetectionEnabled_InProcess_IISExpress()
{
return UpgradeFeatureDetectionDeployer(RuntimeFlavor.CoreClr,
ApplicationType.Portable,
"AppHostConfig/Http.config",
return UpgradeFeatureDetectionDeployer("AppHostConfig/Http.config",
Helpers.GetInProcessTestSitesPath(),
_isWebsocketsSupported);
}
[Fact]
public Task UpgradeFeatureDetectionDisabled_OutOfProcess_IISExpress_CoreClr_x64_Portable()
public Task UpgradeFeatureDetectionDisabled_OutOfProcess_IISExpress()
{
return UpgradeFeatureDetectionDeployer(RuntimeFlavor.CoreClr,
ApplicationType.Portable,
"AppHostConfig/WebsocketsNotSupported.config",
return UpgradeFeatureDetectionDeployer("AppHostConfig/WebsocketsNotSupported.config",
Helpers.GetOutOfProcessTestSitesPath(),
"Disabled");
}
// This test is failing on win7 and win2008
[Fact]
public Task UpgradeFeatureDetectionEnabled_OutOfProcess_IISExpress_CoreClr_x64_Portable()
public Task UpgradeFeatureDetectionEnabled_OutOfProcess_IISExpress()
{
return UpgradeFeatureDetectionDeployer(RuntimeFlavor.CoreClr,
ApplicationType.Portable,
"AppHostConfig/Http.config",
return UpgradeFeatureDetectionDeployer("AppHostConfig/Http.config",
Helpers.GetOutOfProcessTestSitesPath(),
_isWebsocketsSupported);
}
private async Task UpgradeFeatureDetectionDeployer(RuntimeFlavor runtimeFlavor,
ApplicationType applicationType,
string configPath,
string sitePath,
string expected)
private async Task UpgradeFeatureDetectionDeployer(string configPath, string sitePath, string expected)
{
var serverType = ServerType.IISExpress;
var architecture = RuntimeArchitecture.x64;
var testName = $"HelloWorld_{runtimeFlavor}";
var testName = $"HelloWorld";
using (StartLog(out var loggerFactory, testName))
{
var logger = loggerFactory.CreateLogger("HelloWorldTest");
var deploymentParameters = new DeploymentParameters(sitePath, serverType, runtimeFlavor, architecture)
var deploymentParameters = new DeploymentParameters(sitePath, ServerType.IISExpress, RuntimeFlavor.CoreClr, RuntimeArchitecture.x64)
{
EnvironmentName = "UpgradeFeatureDetection", // Will pick the Start class named 'StartupHelloWorld',
ServerConfigTemplateContent = (serverType == ServerType.IISExpress) ? File.ReadAllText(configPath) : null,
ServerConfigTemplateContent = File.ReadAllText(configPath),
SiteName = "HttpTestSite", // This is configured in the Http.config
TargetFramework = "netcoreapp2.1",
ApplicationType = applicationType,
ANCMVersion = ANCMVersion.AspNetCoreModuleV2
TargetFramework = Tfm.NetCoreApp22,
ApplicationType = ApplicationType.Portable,
AncmVersion = AncmVersion.AspNetCoreModuleV2
};
using (var deployer = ApplicationDeployerFactory.Create(deploymentParameters, loggerFactory))

View File

@ -1,62 +0,0 @@
// 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.
using System;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Xml.Linq;
using Microsoft.AspNetCore.Testing.xunit;
namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
{
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Assembly | AttributeTargets.Class)]
public sealed class IISExpressSupportsInProcessHostingAttribute : Attribute, ITestCondition
{
public bool IsMet => AncmSchema.SupportsInProcessHosting;
public string SkipReason => AncmSchema.SkipReason;
private class AncmSchema
{
public static bool SupportsInProcessHosting { get; }
public static string SkipReason { get; } = "IIS Express must be upgraded to support in-process hosting.";
static AncmSchema()
{
if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
SkipReason = "IIS Express tests can only be run on Windows";
return;
}
var ancmConfigPath = Path.Combine(
Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles),
"IIS Express", "config", "schema", "aspnetcore_schema.xml");
if (!File.Exists(ancmConfigPath))
{
SkipReason = "IIS Express is not installed.";
return;
}
XDocument ancmConfig;
try
{
ancmConfig = XDocument.Load(ancmConfigPath);
}
catch
{
SkipReason = "Could not read ANCM schema configuration";
return;
}
SupportsInProcessHosting = ancmConfig
.Root
.Descendants("attribute")
.Any(n => "hostingModel".Equals(n.Attribute("name")?.Value, StringComparison.Ordinal));
}
}
}
}

View File

@ -13,7 +13,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
{
public class IISTestSiteFixture : IDisposable
{
private readonly IApplicationDeployer _deployer;
private readonly ApplicationDeployer _deployer;
public IISTestSiteFixture()
{
@ -26,9 +26,10 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
{
ServerConfigTemplateContent = File.ReadAllText("AppHostConfig/Http.config"),
SiteName = "HttpTestSite",
TargetFramework = "netcoreapp2.1",
TargetFramework = Tfm.NetCoreApp22,
ApplicationType = ApplicationType.Portable,
ANCMVersion = ANCMVersion.AspNetCoreModuleV2,
AncmVersion = AncmVersion.AspNetCoreModuleV2,
HostingModel = HostingModel.InProcess,
};
_deployer = ApplicationDeployerFactory.Create(deploymentParameters, logging.CreateLoggerFactory(null, nameof(IISTestSiteFixture)));