diff --git a/IISIntegration.sln b/IISIntegration.sln index adccebbe1f..a5dbd5dad6 100644 --- a/IISIntegration.sln +++ b/IISIntegration.sln @@ -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 diff --git a/benchmarks/IIS.Performance/IIS.Performance.csproj b/benchmarks/IIS.Performance/IIS.Performance.csproj index 5a29058351..6fb9ab2c05 100644 --- a/benchmarks/IIS.Performance/IIS.Performance.csproj +++ b/benchmarks/IIS.Performance/IIS.Performance.csproj @@ -1,10 +1,10 @@ - + IIS.Performance Microsoft.AspNetCore.Server.IIS.Performance - netcoreapp2.1 + netcoreapp2.2 Exe true true diff --git a/benchmarks/IIS.Performance/StartupTimeBenchmark.cs b/benchmarks/IIS.Performance/StartupTimeBenchmark.cs index 9797a02eba..4cbb53ffaf 100644 --- a/benchmarks/IIS.Performance/StartupTimeBenchmark.cs +++ b/benchmarks/IIS.Performance/StartupTimeBenchmark.cs @@ -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; diff --git a/build/dependencies.props b/build/dependencies.props index 1a4d0a3d40..fc6f28aa40 100644 --- a/build/dependencies.props +++ b/build/dependencies.props @@ -1,4 +1,4 @@ - + $(MSBuildAllProjects);$(MSBuildThisFileFullPath) @@ -14,7 +14,7 @@ 2.2.0-preview1-34217 2.2.0-preview1-34217 2.2.0-preview1-34217 - 0.6.0-preview1-34217 + 0.6.0-a-preview1-inttesting-17031 2.2.0-preview1-34217 2.2.0-preview1-34217 2.2.0-preview1-34217 diff --git a/test/IISIntegration.FunctionalTests/IISIntegration.FunctionalTests.csproj b/test/IISIntegration.FunctionalTests/IISIntegration.FunctionalTests.csproj index 2429bb8509..be7eb2a1d4 100644 --- a/test/IISIntegration.FunctionalTests/IISIntegration.FunctionalTests.csproj +++ b/test/IISIntegration.FunctionalTests/IISIntegration.FunctionalTests.csproj @@ -19,8 +19,6 @@ - - diff --git a/test/IISIntegration.FunctionalTests/Inprocess/AuthenticationTests.cs b/test/IISIntegration.FunctionalTests/Inprocess/AuthenticationTests.cs index 511021b72d..a9cc151e6f 100644 --- a/test/IISIntegration.FunctionalTests/Inprocess/AuthenticationTests.cs +++ b/test/IISIntegration.FunctionalTests/Inprocess/AuthenticationTests.cs @@ -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 diff --git a/test/IISIntegration.FunctionalTests/Inprocess/EnvironmentVariableTests.cs b/test/IISIntegration.FunctionalTests/Inprocess/EnvironmentVariableTests.cs index 413aa4c35f..16467095d8 100644 --- a/test/IISIntegration.FunctionalTests/Inprocess/EnvironmentVariableTests.cs +++ b/test/IISIntegration.FunctionalTests/Inprocess/EnvironmentVariableTests.cs @@ -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; diff --git a/test/IISIntegration.FunctionalTests/Inprocess/FeatureCollectionTests.cs b/test/IISIntegration.FunctionalTests/Inprocess/FeatureCollectionTests.cs index 8aa54716e3..b946446db7 100644 --- a/test/IISIntegration.FunctionalTests/Inprocess/FeatureCollectionTests.cs +++ b/test/IISIntegration.FunctionalTests/Inprocess/FeatureCollectionTests.cs @@ -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; diff --git a/test/IISIntegration.FunctionalTests/Inprocess/HelloWorldTests.cs b/test/IISIntegration.FunctionalTests/Inprocess/HelloWorldTests.cs index ce569acfe7..ebc67312df 100644 --- a/test/IISIntegration.FunctionalTests/Inprocess/HelloWorldTests.cs +++ b/test/IISIntegration.FunctionalTests/Inprocess/HelloWorldTests.cs @@ -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")); diff --git a/test/IISIntegration.FunctionalTests/Inprocess/InvalidReadWriteOperationTests.cs b/test/IISIntegration.FunctionalTests/Inprocess/InvalidReadWriteOperationTests.cs index 95c05308bd..ae27eb426e 100644 --- a/test/IISIntegration.FunctionalTests/Inprocess/InvalidReadWriteOperationTests.cs +++ b/test/IISIntegration.FunctionalTests/Inprocess/InvalidReadWriteOperationTests.cs @@ -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; diff --git a/test/IISIntegration.FunctionalTests/Inprocess/LargeResponseBodyTests.cs b/test/IISIntegration.FunctionalTests/Inprocess/LargeResponseBodyTests.cs index 40db2cfdb8..3578718ef6 100644 --- a/test/IISIntegration.FunctionalTests/Inprocess/LargeResponseBodyTests.cs +++ b/test/IISIntegration.FunctionalTests/Inprocess/LargeResponseBodyTests.cs @@ -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; diff --git a/test/IISIntegration.FunctionalTests/Inprocess/ResponseHeaderTests.cs b/test/IISIntegration.FunctionalTests/Inprocess/ResponseHeaderTests.cs index 47ca0dc808..d96a0ae850 100644 --- a/test/IISIntegration.FunctionalTests/Inprocess/ResponseHeaderTests.cs +++ b/test/IISIntegration.FunctionalTests/Inprocess/ResponseHeaderTests.cs @@ -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; diff --git a/test/IISIntegration.FunctionalTests/Inprocess/ResponseInvalidOrderingTests.cs b/test/IISIntegration.FunctionalTests/Inprocess/ResponseInvalidOrderingTests.cs index 2e484724e6..1bf0f1a483 100644 --- a/test/IISIntegration.FunctionalTests/Inprocess/ResponseInvalidOrderingTests.cs +++ b/test/IISIntegration.FunctionalTests/Inprocess/ResponseInvalidOrderingTests.cs @@ -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; diff --git a/test/IISIntegration.FunctionalTests/Inprocess/ServerVariablesTest.cs b/test/IISIntegration.FunctionalTests/Inprocess/ServerVariablesTest.cs index d6fd676346..56b04c208e 100644 --- a/test/IISIntegration.FunctionalTests/Inprocess/ServerVariablesTest.cs +++ b/test/IISIntegration.FunctionalTests/Inprocess/ServerVariablesTest.cs @@ -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; diff --git a/test/IISIntegration.FunctionalTests/Inprocess/StartupTests.cs b/test/IISIntegration.FunctionalTests/Inprocess/StartupTests.cs index de20779726..7ae5affc83 100644 --- a/test/IISIntegration.FunctionalTests/Inprocess/StartupTests.cs +++ b/test/IISIntegration.FunctionalTests/Inprocess/StartupTests.cs @@ -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 }; } diff --git a/test/IISIntegration.FunctionalTests/Inprocess/SynchronousReadAndWriteTests.cs b/test/IISIntegration.FunctionalTests/Inprocess/SynchronousReadAndWriteTests.cs index e9b7f9ad62..469018acb2 100644 --- a/test/IISIntegration.FunctionalTests/Inprocess/SynchronousReadAndWriteTests.cs +++ b/test/IISIntegration.FunctionalTests/Inprocess/SynchronousReadAndWriteTests.cs @@ -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; diff --git a/test/IISIntegration.FunctionalTests/OutOfProcess/HelloWorldTest.cs b/test/IISIntegration.FunctionalTests/OutOfProcess/HelloWorldTest.cs index 7160366ac2..766b4915bc 100644 --- a/test/IISIntegration.FunctionalTests/OutOfProcess/HelloWorldTest.cs +++ b/test/IISIntegration.FunctionalTests/OutOfProcess/HelloWorldTest.cs @@ -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 diff --git a/test/IISIntegration.FunctionalTests/OutOfProcess/HttpsTest.cs b/test/IISIntegration.FunctionalTests/OutOfProcess/HttpsTest.cs index 384c890f2e..ddf22e726b 100644 --- a/test/IISIntegration.FunctionalTests/OutOfProcess/HttpsTest.cs +++ b/test/IISIntegration.FunctionalTests/OutOfProcess/HttpsTest.cs @@ -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 diff --git a/test/IISIntegration.FunctionalTests/OutOfProcess/NtlmAuthentationTest.cs b/test/IISIntegration.FunctionalTests/OutOfProcess/NtlmAuthentationTest.cs index d9ce75a5c5..b8c0567f3f 100644 --- a/test/IISIntegration.FunctionalTests/OutOfProcess/NtlmAuthentationTest.cs +++ b/test/IISIntegration.FunctionalTests/OutOfProcess/NtlmAuthentationTest.cs @@ -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 diff --git a/test/IISIntegration.FunctionalTests/Properties/AssemblyInfo.cs b/test/IISIntegration.FunctionalTests/Properties/AssemblyInfo.cs index 240f2d35c0..a150572c1f 100644 --- a/test/IISIntegration.FunctionalTests/Properties/AssemblyInfo.cs +++ b/test/IISIntegration.FunctionalTests/Properties/AssemblyInfo.cs @@ -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)] diff --git a/test/IISIntegration.FunctionalTests/UpgradeFeatureDetectionTests.cs b/test/IISIntegration.FunctionalTests/UpgradeFeatureDetectionTests.cs index d566b4c330..de58d20cee 100644 --- a/test/IISIntegration.FunctionalTests/UpgradeFeatureDetectionTests.cs +++ b/test/IISIntegration.FunctionalTests/UpgradeFeatureDetectionTests.cs @@ -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)) diff --git a/test/IISIntegration.FunctionalTests/Utilities/IISExpressSupportsInProcessHostingAttribute.cs b/test/IISIntegration.FunctionalTests/Utilities/IISExpressSupportsInProcessHostingAttribute.cs deleted file mode 100644 index 5f2edd22f6..0000000000 --- a/test/IISIntegration.FunctionalTests/Utilities/IISExpressSupportsInProcessHostingAttribute.cs +++ /dev/null @@ -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)); - } - } - } -} diff --git a/test/IISIntegration.FunctionalTests/Utilities/IISTestSiteFixture.cs b/test/IISIntegration.FunctionalTests/Utilities/IISTestSiteFixture.cs index 5fef8660ca..98cb337f4f 100644 --- a/test/IISIntegration.FunctionalTests/Utilities/IISTestSiteFixture.cs +++ b/test/IISIntegration.FunctionalTests/Utilities/IISTestSiteFixture.cs @@ -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)));