diff --git a/Directory.Build.targets b/Directory.Build.targets index 9ea039e661..506c1e4e1f 100644 --- a/Directory.Build.targets +++ b/Directory.Build.targets @@ -1,5 +1,8 @@  + + $(MicrosoftNETCoreApp20PackageVersion) + $(MicrosoftNETCoreApp21PackageVersion) $(MicrosoftNETCoreApp22PackageVersion) $(NETStandardLibrary20PackageVersion) diff --git a/MusicStore.sln b/MusicStore.sln index c4edf6d02a..971038d4bd 100644 --- a/MusicStore.sln +++ b/MusicStore.sln @@ -21,7 +21,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MusicStore.E2ETests", "test EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{88A30728-49E5-46C5-9CEC-9D8FD346A043}" ProjectSection(SolutionItems) = preProject + build\dependencies.props = build\dependencies.props + build\repo.props = build\repo.props build\repo.targets = build\repo.targets + build\sources.props = build\sources.props EndProjectSection EndProject Global diff --git a/build/dependencies.props b/build/dependencies.props index c72ee219da..bc53630124 100644 --- a/build/dependencies.props +++ b/build/dependencies.props @@ -3,39 +3,41 @@ $(MSBuildAllProjects);$(MSBuildThisFileFullPath) - 2.2.0-preview1-34194 - 2.2.0-preview1-34194 - 2.2.0-preview1-34194 - 2.2.0-preview1-34194 - 2.2.0-preview1-34194 - 2.2.0-preview1-34194 - 2.2.0-preview1-34194 - 2.2.0-preview1-34194 - 2.2.0-preview1-34194 - 2.2.0-preview1-34194 - 2.2.0-preview1-34194 - 2.2.0-preview1-34194 - 2.2.0-preview1-34194 - 2.2.0-preview1-34194 - 2.2.0-preview1-34194 - 2.2.0-preview1-34194 - 0.6.0-preview1-34194 - 2.2.0-preview1-34194 - 2.2.0-preview1-34194 - 2.2.0-preview1-34194 - 2.2.0-preview1-34194 - 2.2.0-preview1-34194 - 2.2.0-preview1-34194 - 2.2.0-preview1-34194 - 2.2.0-preview1-34194 - 2.2.0-preview1-34194 - 2.2.0-preview1-34194 - 2.2.0-preview1-34194 - 2.2.0-preview1-34194 - 2.2.0-preview1-34194 - 2.2.0-preview1-34194 + 2.2.0-preview1-34217 + 2.2.0-preview1-34217 + 2.2.0-preview1-34217 + 2.2.0-preview1-34217 + 2.2.0-preview1-34217 + 2.2.0-preview1-34217 + 2.2.0-preview1-34217 + 2.2.0-preview1-34217 + 2.2.0-preview1-34217 + 2.2.0-preview1-34217 + 2.2.0-preview1-34217 + 2.2.0-preview1-34217 + 2.2.0-preview1-34217 + 2.2.0-preview1-34217 + 2.2.0-preview1-34217 + 2.2.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 + 2.2.0-preview1-34217 + 2.2.0-preview1-34217 + 2.2.0-preview1-34217 + 2.2.0-preview1-34217 + 2.2.0-preview1-34217 + 2.2.0-preview1-34217 + 2.2.0-preview1-34217 + 2.2.0-preview1-34217 + 2.2.0-preview1-34217 + 2.2.0-preview1-34217 + 2.2.0-preview1-34217 + 2.0.0 + 2.1.0-rc1 2.2.0-preview1-26509-06 - 2.2.0-preview1-34194 + 2.2.0-preview1-34217 15.6.1 2.0.3 4.6.0-preview1-26508-04 diff --git a/build/repo.props b/build/repo.props index 81d20dd22c..1add62910e 100644 --- a/build/repo.props +++ b/build/repo.props @@ -8,6 +8,8 @@ + + diff --git a/samples/MusicStore/MusicStore.csproj b/samples/MusicStore/MusicStore.csproj index 93fce56d94..9d0023c114 100644 --- a/samples/MusicStore/MusicStore.csproj +++ b/samples/MusicStore/MusicStore.csproj @@ -2,7 +2,7 @@ Music store application on ASP.NET Core - netcoreapp2.2;net461 + netcoreapp2.2;netcoreapp2.1;netcoreapp2.0;net461 $(DefineConstants);DEMO true win7-x86;win7-x64;linux-x64;osx-x64 diff --git a/test/MusicStore.E2ETests/Common/Helpers.cs b/test/MusicStore.E2ETests/Common/Helpers.cs index a367aefbfc..d526b5d3f1 100644 --- a/test/MusicStore.E2ETests/Common/Helpers.cs +++ b/test/MusicStore.E2ETests/Common/Helpers.cs @@ -13,15 +13,6 @@ namespace E2ETests return Path.GetFullPath(Path.Combine(solutionDirectory, "samples", "MusicStore")); } - public static string GetCurrentBuildConfiguration() - { -#if DEBUG - return "Debug"; -#else - return "Release"; -#endif - } - public static bool PreservePublishedApplicationForDebugging { get @@ -39,19 +30,5 @@ namespace E2ETests return false; } } - - public static string GetTargetFramework(RuntimeFlavor flavor) - { - if (flavor == RuntimeFlavor.Clr) - { - return "net461"; - } - else if (flavor == RuntimeFlavor.CoreClr) - { - return "netcoreapp2.2"; - } - - throw new ArgumentException($"Unknown runtime flavor '{flavor}."); - } } } diff --git a/test/MusicStore.E2ETests/DotnetRunTestRunner.cs b/test/MusicStore.E2ETests/DotnetRunTests.cs similarity index 75% rename from test/MusicStore.E2ETests/DotnetRunTestRunner.cs rename to test/MusicStore.E2ETests/DotnetRunTests.cs index d5f38e8de2..c9e6177d5f 100644 --- a/test/MusicStore.E2ETests/DotnetRunTestRunner.cs +++ b/test/MusicStore.E2ETests/DotnetRunTests.cs @@ -1,14 +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. -using System; -using System.Collections.Generic; -using System.IO; using System.Net.Http; -using System.Text; -using System.Threading; 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; @@ -16,33 +12,28 @@ using Xunit.Abstractions; namespace E2ETests { - public class DotnetRunTestRunner : LoggedTest + [Trait("E2Etests", "DotnetRun")] + public class DotnetRunTests : LoggedTest { - public DotnetRunTestRunner(ITestOutputHelper output) - : base(output) - { - } + public static TestMatrix TestVariants + => TestMatrix.ForServers(ServerType.Kestrel) + .WithAllApplicationTypes() + .WithTfms(Tfm.NetCoreApp22, Tfm.NetCoreApp21, Tfm.NetCoreApp20, Tfm.Net461); - public async Task RunTests( - ServerType serverType, - RuntimeFlavor runtimeFlavor, - ApplicationType applicationType, - RuntimeArchitecture runtimeArchitecture) + [ConditionalTheory] + [MemberData(nameof(TestVariants))] + public async Task DotnetRun_Tests(TestVariant variant) { - var testName = $"DotnetRunTests_{serverType}_{runtimeFlavor}_{applicationType}"; + var testName = $"DotnetRunTests_{variant}"; using (StartLog(out var loggerFactory, testName)) { var logger = loggerFactory.CreateLogger("DotnetRunTests"); var musicStoreDbName = DbUtils.GetUniqueName(); - var applicationPath = Helpers.GetApplicationPath(); - var deploymentParameters = new DeploymentParameters( - applicationPath, serverType, runtimeFlavor, runtimeArchitecture) + var deploymentParameters = new DeploymentParameters(variant) { + ApplicationPath = Helpers.GetApplicationPath(), PublishApplicationBeforeDeployment = false, - TargetFramework = Helpers.GetTargetFramework(runtimeFlavor), - Configuration = Helpers.GetCurrentBuildConfiguration(), EnvironmentName = "Development", - ApplicationType = applicationType, UserAdditionalCleanup = parameters => { DbUtils.DropDatabase(musicStoreDbName, logger); diff --git a/test/MusicStore.E2ETests/DotnetRunTests_X64.cs b/test/MusicStore.E2ETests/DotnetRunTests_X64.cs deleted file mode 100644 index 062b0ac287..0000000000 --- a/test/MusicStore.E2ETests/DotnetRunTests_X64.cs +++ /dev/null @@ -1,39 +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.Threading.Tasks; -using Microsoft.AspNetCore.Server.IntegrationTesting; -using Microsoft.AspNetCore.Testing.xunit; -using Xunit; -using Xunit.Abstractions; - -namespace E2ETests -{ - [Trait("E2Etests", "DotnetRun")] - public class DotnetRunTests_X64 - { - private readonly DotnetRunTestRunner _testRunner; - - public DotnetRunTests_X64(ITestOutputHelper output) - { - _testRunner = new DotnetRunTestRunner(output); - } - - [Fact] - public Task DotnetRunTests_X64_Kestrel_CoreClr() - { - return RunTests(ServerType.Kestrel, RuntimeFlavor.CoreClr, ApplicationType.Portable); - } - - [ConditionalFact] - [OSSkipCondition(OperatingSystems.Linux | OperatingSystems.MacOSX)] - public Task DotnetRunTests_X64_Kestrel_Clr() - { - // CLR must be published as standalone to perform rid specific deployment - return RunTests(ServerType.Kestrel, RuntimeFlavor.Clr, ApplicationType.Standalone); - } - - private Task RunTests(ServerType serverType, RuntimeFlavor runtimeFlavor, ApplicationType applicationType) - => _testRunner.RunTests(serverType, runtimeFlavor, applicationType, RuntimeArchitecture.x64); - } -} diff --git a/test/MusicStore.E2ETests/NtlmAuthentationTest.cs b/test/MusicStore.E2ETests/NtlmAuthentationTest.cs index 8213019bff..f54ac664a5 100644 --- a/test/MusicStore.E2ETests/NtlmAuthentationTest.cs +++ b/test/MusicStore.E2ETests/NtlmAuthentationTest.cs @@ -13,67 +13,30 @@ using Xunit.Abstractions; namespace E2ETests { [Trait("E2Etests", "E2Etests")] - [OSSkipCondition(OperatingSystems.Linux | OperatingSystems.MacOSX)] public class NtlmAuthenticationTests : LoggedTest { - public NtlmAuthenticationTests(ITestOutputHelper output) : base(output) - { - } + public static TestMatrix TestVariants + => TestMatrix.ForServers(ServerType.IISExpress, ServerType.HttpSys) + .WithTfms(Tfm.NetCoreApp22, Tfm.NetCoreApp21, Tfm.NetCoreApp20, Tfm.Net461) + .WithAllApplicationTypes(); - [ConditionalFact] - public Task NtlmAuthenticationTest_WebListener_CoreCLR_Portable() + [ConditionalTheory] + [MemberData(nameof(TestVariants))] + private async Task NtlmAuthenticationTest(TestVariant variant) { - return NtlmAuthenticationTest(ServerType.WebListener, RuntimeFlavor.CoreClr, ApplicationType.Portable); - } - - [ConditionalFact] - public Task NtlmAuthenticationTest_WebListener_CoreCLR_Standalone() - { - return NtlmAuthenticationTest(ServerType.WebListener, RuntimeFlavor.CoreClr, ApplicationType.Standalone); - } - - [ConditionalFact] - public Task NtlmAuthenticationTest_IISExpress_CoreCLR_Portable() - { - return NtlmAuthenticationTest(ServerType.IISExpress, RuntimeFlavor.CoreClr, ApplicationType.Portable); - } - - [ConditionalFact] - public Task NtlmAuthenticationTest_IISExpress_CoreCLR_Standalone() - { - return NtlmAuthenticationTest(ServerType.IISExpress, RuntimeFlavor.CoreClr, ApplicationType.Standalone); - } - - [ConditionalFact] - public Task NtlmAuthenticationTest_WebListener_CLR() - { - return NtlmAuthenticationTest(ServerType.WebListener, RuntimeFlavor.Clr, ApplicationType.Portable); - } - - [ConditionalFact(Skip = "https://github.com/aspnet/websdk/pull/322")] - public Task NtlmAuthenticationTest_IISExpress_CLR() - { - return NtlmAuthenticationTest(ServerType.IISExpress, RuntimeFlavor.Clr, ApplicationType.Standalone); - } - - private async Task NtlmAuthenticationTest(ServerType serverType, RuntimeFlavor runtimeFlavor, ApplicationType applicationType) - { - var architecture = RuntimeArchitecture.x64; - var testName = $"NtlmAuthentication_{serverType}_{runtimeFlavor}_{applicationType}"; + var testName = $"NtlmAuthentication_{variant}"; using (StartLog(out var loggerFactory, testName)) { var logger = loggerFactory.CreateLogger("NtlmAuthenticationTest"); var musicStoreDbName = DbUtils.GetUniqueName(); - var deploymentParameters = new DeploymentParameters(Helpers.GetApplicationPath(), serverType, runtimeFlavor, architecture) + var deploymentParameters = new DeploymentParameters(variant) { + ApplicationPath = Helpers.GetApplicationPath(), PublishApplicationBeforeDeployment = true, PreservePublishedApplicationForDebugging = Helpers.PreservePublishedApplicationForDebugging, - TargetFramework = Helpers.GetTargetFramework(runtimeFlavor), - Configuration = Helpers.GetCurrentBuildConfiguration(), - ApplicationType = applicationType, EnvironmentName = "NtlmAuthentication", //Will pick the Start class named 'StartupNtlmAuthentication' - ServerConfigTemplateContent = (serverType == ServerType.IISExpress) ? File.ReadAllText(Path.Combine(AppContext.BaseDirectory, "NtlmAuthentation.config")) : null, + ServerConfigTemplateContent = (variant.Server == ServerType.IISExpress) ? File.ReadAllText(Path.Combine(AppContext.BaseDirectory, "NtlmAuthentation.config")) : null, SiteName = "MusicStoreNtlmAuthentication", //This is configured in the NtlmAuthentication.config UserAdditionalCleanup = parameters => { diff --git a/test/MusicStore.E2ETests/OpenIdConnectTests.cs b/test/MusicStore.E2ETests/OpenIdConnectTests.cs index 82bf49d6a4..79bf923ad8 100644 --- a/test/MusicStore.E2ETests/OpenIdConnectTests.cs +++ b/test/MusicStore.E2ETests/OpenIdConnectTests.cs @@ -13,45 +13,25 @@ namespace E2ETests [Trait("E2Etests", "E2Etests")] public class OpenIdConnectTests : LoggedTest { - public OpenIdConnectTests(ITestOutputHelper output) : base(output) - { - } + public static TestMatrix TestVariants + => TestMatrix.ForServers(ServerType.IISExpress, ServerType.Kestrel, ServerType.Nginx) + .WithTfms(Tfm.NetCoreApp22, Tfm.NetCoreApp21, Tfm.NetCoreApp20, Tfm.Net461); - [Fact] - public Task OpenIdConnect_Kestrel_CoreCLR_Portable() + [ConditionalTheory] + [MemberData(nameof(TestVariants))] + public async Task OpenIdConnectTestSuite(TestVariant variant) { - return OpenIdConnectTestSuite(ServerType.Kestrel, RuntimeFlavor.CoreClr, ApplicationType.Portable); - } - - [Fact] - public Task OpenIdConnect_Kestrel_CoreCLR_Standalone() - { - return OpenIdConnectTestSuite(ServerType.Kestrel, RuntimeFlavor.CoreClr, ApplicationType.Standalone); - } - - [ConditionalFact] - [OSSkipCondition(OperatingSystems.Linux | OperatingSystems.MacOSX)] - public Task OpenIdConnect_Kestrel_CLR() - { - return OpenIdConnectTestSuite(ServerType.Kestrel, RuntimeFlavor.Clr, ApplicationType.Portable); - } - - private async Task OpenIdConnectTestSuite(ServerType serverType, RuntimeFlavor runtimeFlavor, ApplicationType applicationType) - { - var architecture = RuntimeArchitecture.x64; - var testName = $"OpenIdConnectTestSuite_{serverType}_{runtimeFlavor}_{architecture}_{applicationType}"; + var testName = $"OpenIdConnectTestSuite_{variant}"; using (StartLog(out var loggerFactory, testName)) { var logger = loggerFactory.CreateLogger("OpenIdConnectTestSuite"); var musicStoreDbName = DbUtils.GetUniqueName(); - var deploymentParameters = new DeploymentParameters(Helpers.GetApplicationPath(), serverType, runtimeFlavor, architecture) + var deploymentParameters = new DeploymentParameters(variant) { + ApplicationPath = Helpers.GetApplicationPath(), PublishApplicationBeforeDeployment = true, PreservePublishedApplicationForDebugging = Helpers.PreservePublishedApplicationForDebugging, - TargetFramework = Helpers.GetTargetFramework(runtimeFlavor), - Configuration = Helpers.GetCurrentBuildConfiguration(), - ApplicationType = applicationType, EnvironmentName = "OpenIdConnectTesting", UserAdditionalCleanup = parameters => { diff --git a/test/MusicStore.E2ETests/PublishAndRunTestRunner.cs b/test/MusicStore.E2ETests/PublishAndRunTests.cs similarity index 76% rename from test/MusicStore.E2ETests/PublishAndRunTestRunner.cs rename to test/MusicStore.E2ETests/PublishAndRunTests.cs index f12a68f25c..b17d76bb51 100644 --- a/test/MusicStore.E2ETests/PublishAndRunTestRunner.cs +++ b/test/MusicStore.E2ETests/PublishAndRunTests.cs @@ -1,9 +1,10 @@ -using System; +using System; using System.Collections.Generic; using System.IO; 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; @@ -11,33 +12,32 @@ using Xunit.Abstractions; namespace E2ETests { - public class PublishAndRunTestRunner : LoggedTest + [Trait("E2Etests", "PublishAndRun")] + public class PublishAndRunTests : LoggedTest { - public PublishAndRunTestRunner(ITestOutputHelper output) - : base(output) - { - } + public static TestMatrix TestVariants + => TestMatrix.ForServers(ServerType.IISExpress, ServerType.Kestrel, ServerType.Nginx, ServerType.HttpSys) + .WithTfms(Tfm.NetCoreApp22, Tfm.NetCoreApp21, Tfm.NetCoreApp20, Tfm.Net461) + .WithAllApplicationTypes() + .WithAllArchitectures() + .Skip("https://github.com/aspnet/Hosting/issues/601", + v => v.Tfm != Tfm.Net461 && v.Architecture == RuntimeArchitecture.x86); - public async Task RunTests( - ServerType serverType, - RuntimeFlavor runtimeFlavor, - ApplicationType applicationType, - RuntimeArchitecture runtimeArchitecture) + [ConditionalTheory] + [MemberData(nameof(TestVariants))] + public async Task PublishAndRun_Test(TestVariant variant) { - var testName = $"PublishAndRunTests_{serverType}_{runtimeFlavor}_{applicationType}"; + var testName = $"PublishAndRunTests_{variant}"; using (StartLog(out var loggerFactory, testName)) { var logger = loggerFactory.CreateLogger("Publish_And_Run_Tests"); var musicStoreDbName = DbUtils.GetUniqueName(); - var deploymentParameters = new DeploymentParameters( - Helpers.GetApplicationPath(), serverType, runtimeFlavor, runtimeArchitecture) + var deploymentParameters = new DeploymentParameters(variant) { + ApplicationPath = Helpers.GetApplicationPath(), PublishApplicationBeforeDeployment = true, PreservePublishedApplicationForDebugging = Helpers.PreservePublishedApplicationForDebugging, - TargetFramework = Helpers.GetTargetFramework(runtimeFlavor), - Configuration = Helpers.GetCurrentBuildConfiguration(), - ApplicationType = applicationType, UserAdditionalCleanup = parameters => { DbUtils.DropDatabase(musicStoreDbName, logger); @@ -72,7 +72,7 @@ namespace E2ETests logger.LogInformation("Verifying static files are served from static file middleware"); await validator.VerifyStaticContentServed(); - if (serverType != ServerType.IISExpress) + if (variant.Server != ServerType.IISExpress) { if (Directory.GetFiles( deploymentParameters.ApplicationPath, "*.cmd", SearchOption.TopDirectoryOnly).Length > 0) diff --git a/test/MusicStore.E2ETests/PublishAndRunTests_X64.cs b/test/MusicStore.E2ETests/PublishAndRunTests_X64.cs deleted file mode 100644 index 76161cb6f9..0000000000 --- a/test/MusicStore.E2ETests/PublishAndRunTests_X64.cs +++ /dev/null @@ -1,64 +0,0 @@ -using System.Threading.Tasks; -using Microsoft.AspNetCore.Server.IntegrationTesting; -using Microsoft.AspNetCore.Testing.xunit; -using Xunit; -using Xunit.Abstractions; - -namespace E2ETests -{ - [Trait("E2Etests", "PublishAndRun")] - public class PublishAndRunTests_X64 - { - private readonly PublishAndRunTestRunner _testRunner; - - public PublishAndRunTests_X64(ITestOutputHelper output) - { - _testRunner = new PublishAndRunTestRunner(output); - } - - [ConditionalFact] - [OSSkipCondition(OperatingSystems.Linux | OperatingSystems.MacOSX)] - public Task PublishAndRunTests_X64_WebListener_CoreCLR_Portable() - { - return RunTests(ServerType.WebListener, RuntimeFlavor.CoreClr, ApplicationType.Portable); - } - - [ConditionalFact] - [OSSkipCondition(OperatingSystems.Linux | OperatingSystems.MacOSX)] - public Task PublishAndRunTests_X64_WebListener_CoreCLR_Standalone() - { - return RunTests(ServerType.WebListener, RuntimeFlavor.CoreClr, ApplicationType.Standalone); - } - - [ConditionalFact] - [OSSkipCondition(OperatingSystems.Linux | OperatingSystems.MacOSX)] - public Task PublishAndRunTests_X64_WebListener_Clr() - { - // CLR must be published as standalone to perform rid specific deployment - return RunTests(ServerType.WebListener, RuntimeFlavor.Clr, ApplicationType.Standalone); - } - - [Fact] - public Task PublishAndRunTests_X64_Kestrel_CoreClr_Portable() - { - return RunTests(ServerType.Kestrel, RuntimeFlavor.CoreClr, ApplicationType.Portable); - } - - [Fact] - public Task PublishAndRunTests_X64_Kestrel_CoreClr_Standalone() - { - return RunTests(ServerType.Kestrel, RuntimeFlavor.CoreClr, ApplicationType.Standalone); - } - - [ConditionalFact] - [OSSkipCondition(OperatingSystems.Linux | OperatingSystems.MacOSX)] - public Task PublishAndRunTests_X64_Kestrel_Clr() - { - // CLR must be published as standalone to perform rid specific deployment - return RunTests(ServerType.Kestrel, RuntimeFlavor.Clr, ApplicationType.Standalone); - } - - private Task RunTests(ServerType serverType, RuntimeFlavor runtimeFlavor, ApplicationType applicationType) - => _testRunner.RunTests(serverType, runtimeFlavor, applicationType, RuntimeArchitecture.x64); - } -} diff --git a/test/MusicStore.E2ETests/PublishAndRunTests_X86.cs b/test/MusicStore.E2ETests/PublishAndRunTests_X86.cs deleted file mode 100644 index 88bd49c980..0000000000 --- a/test/MusicStore.E2ETests/PublishAndRunTests_X86.cs +++ /dev/null @@ -1,38 +0,0 @@ -using System.Threading.Tasks; -using Microsoft.AspNetCore.Server.IntegrationTesting; -using Microsoft.AspNetCore.Testing.xunit; -using Xunit; -using Xunit.Abstractions; - -namespace E2ETests -{ - [Trait("E2Etests", "PublishAndRun")] - public class PublishAndRunTests_X86 - { - private readonly PublishAndRunTestRunner _testRunner; - - public PublishAndRunTests_X86(ITestOutputHelper output) - { - _testRunner = new PublishAndRunTestRunner(output); - } - - [ConditionalFact] - [OSSkipCondition(OperatingSystems.Linux | OperatingSystems.MacOSX)] - public Task PublishAndRunTests_X86_WebListener_Clr() - { - // CLR must be published as standalone to perform rid specific deployment - return RunTests(ServerType.WebListener, RuntimeFlavor.Clr, ApplicationType.Standalone); - } - - [ConditionalFact] - [OSSkipCondition(OperatingSystems.Linux | OperatingSystems.MacOSX)] - public Task PublishAndRunTests_X86_Kestrel_Clr() - { - // CLR must be published as standalone to perform rid specific deployment - return RunTests(ServerType.Kestrel, RuntimeFlavor.Clr, ApplicationType.Standalone); - } - - private Task RunTests(ServerType serverType, RuntimeFlavor runtimeFlavor, ApplicationType applicationType) - => _testRunner.RunTests(serverType, runtimeFlavor, applicationType, RuntimeArchitecture.x86); - } -} diff --git a/test/MusicStore.E2ETests/SmokeTestRunner.cs b/test/MusicStore.E2ETests/SmokeTests.cs similarity index 86% rename from test/MusicStore.E2ETests/SmokeTestRunner.cs rename to test/MusicStore.E2ETests/SmokeTests.cs index eb766b7da4..dd9b66bf77 100644 --- a/test/MusicStore.E2ETests/SmokeTestRunner.cs +++ b/test/MusicStore.E2ETests/SmokeTests.cs @@ -1,9 +1,10 @@ -using System; +using System; using System.Collections.Generic; using System.IO; 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; @@ -11,35 +12,32 @@ using Xunit.Abstractions; namespace E2ETests { - public class SmokeTestRunner : LoggedTest + [Trait("E2Etests", "Smoke")] + public class SmokeTests : LoggedTest { - public SmokeTestRunner(ITestOutputHelper output) : base(output) - { - } + public static TestMatrix TestVariants + => TestMatrix.ForServers(ServerType.IISExpress, ServerType.Kestrel, ServerType.Nginx, ServerType.HttpSys) + .WithTfms(Tfm.NetCoreApp22, Tfm.NetCoreApp21, Tfm.NetCoreApp20, Tfm.Net461) + .WithAllApplicationTypes(); - public async Task SmokeTestSuite( - ServerType serverType, - RuntimeFlavor runtimeFlavor, - RuntimeArchitecture architecture, - ApplicationType applicationType) + [ConditionalTheory] + [MemberData(nameof(TestVariants))] + public async Task Smoke_Tests(TestVariant variant) { - var testName = $"SmokeTestSuite_{serverType}_{applicationType}"; + var testName = $"SmokeTestSuite_{variant}"; using (StartLog(out var loggerFactory, testName)) { var logger = loggerFactory.CreateLogger("SmokeTestSuite"); var musicStoreDbName = DbUtils.GetUniqueName(); - var deploymentParameters = new DeploymentParameters( - Helpers.GetApplicationPath(), serverType, runtimeFlavor, architecture) + var deploymentParameters = new DeploymentParameters(variant) { + ApplicationPath = Helpers.GetApplicationPath(), EnvironmentName = "SocialTesting", - ServerConfigTemplateContent = (serverType == ServerType.IISExpress) ? File.ReadAllText("Http.config") : null, + ServerConfigTemplateContent = (variant.Server == ServerType.IISExpress) ? File.ReadAllText("Http.config") : null, SiteName = "MusicStoreTestSite", PublishApplicationBeforeDeployment = true, PreservePublishedApplicationForDebugging = Helpers.PreservePublishedApplicationForDebugging, - TargetFramework = Helpers.GetTargetFramework(runtimeFlavor), - Configuration = Helpers.GetCurrentBuildConfiguration(), - ApplicationType = applicationType, UserAdditionalCleanup = parameters => { DbUtils.DropDatabase(musicStoreDbName, logger); @@ -61,7 +59,7 @@ namespace E2ETests } } - public static async Task RunTestsAsync(DeploymentResult deploymentResult, ILogger logger) + internal static async Task RunTestsAsync(DeploymentResult deploymentResult, ILogger logger) { var httpClientHandler = new HttpClientHandler(); var httpClient = deploymentResult.CreateHttpClient(httpClientHandler); diff --git a/test/MusicStore.E2ETests/SmokeTestsOnNanoServer.cs b/test/MusicStore.E2ETests/SmokeTestsOnNanoServer.cs index 64ef491ca4..496aee6446 100644 --- a/test/MusicStore.E2ETests/SmokeTestsOnNanoServer.cs +++ b/test/MusicStore.E2ETests/SmokeTestsOnNanoServer.cs @@ -29,7 +29,7 @@ namespace E2ETests [OSSkipCondition(OperatingSystems.Linux | OperatingSystems.MacOSX)] [SkipIfEnvironmentVariableNotEnabled("RUN_TESTS_ON_NANO")] [InlineData(ServerType.Kestrel, 5000, ApplicationType.Standalone)] - [InlineData(ServerType.WebListener, 5000, ApplicationType.Standalone)] + [InlineData(ServerType.HttpSys, 5000, ApplicationType.Standalone)] [InlineData(ServerType.IIS, 8080, ApplicationType.Standalone)] public async Task Test(ServerType serverType, int portToListen, ApplicationType applicationType) { @@ -60,7 +60,7 @@ namespace E2ETests [OSSkipCondition(OperatingSystems.Linux | OperatingSystems.MacOSX)] [SkipIfEnvironmentVariableNotEnabled("RUN_TESTS_ON_NANO")] [InlineData(ServerType.Kestrel, 5000, ApplicationType.Portable)] - [InlineData(ServerType.WebListener, 5000, ApplicationType.Portable)] + [InlineData(ServerType.HttpSys, 5000, ApplicationType.Portable)] [InlineData(ServerType.IIS, 8080, ApplicationType.Portable)] public async Task Test(ServerType serverType, int portToListen, ApplicationType applicationType) { @@ -244,7 +244,7 @@ namespace E2ETests _remoteDeploymentConfig.AccountName, _remoteDeploymentConfig.AccountPassword) { - TargetFramework = Helpers.GetTargetFramework(RuntimeFlavor.CoreClr), + TargetFramework = Tfm.NetCoreApp22, ApplicationBaseUriHint = applicationBaseUrl, ApplicationType = applicationType }; @@ -256,7 +256,7 @@ namespace E2ETests { var deploymentResult = await deployer.DeployAsync(); - await SmokeTestRunner.RunTestsAsync(deploymentResult, logger); + await SmokeTests.RunTestsAsync(deploymentResult, logger); } } } diff --git a/test/MusicStore.E2ETests/SmokeTestsUsingStore/Tests.cs b/test/MusicStore.E2ETests/SmokeTestsUsingStore/Tests.cs deleted file mode 100644 index 1d65cfb616..0000000000 --- a/test/MusicStore.E2ETests/SmokeTestsUsingStore/Tests.cs +++ /dev/null @@ -1,31 +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.Threading.Tasks; -using Microsoft.AspNetCore.Server.IntegrationTesting; -using Microsoft.AspNetCore.Testing.xunit; -using Microsoft.Extensions.Logging.Testing; -using Xunit; -using Xunit.Abstractions; - -namespace E2ETests.SmokeTestsUsingStore -{ - public class SmokeTests : LoggedTest - { - private readonly ITestOutputHelper _output; - - public SmokeTests(ITestOutputHelper output): base(output) - { - _output = output; - } - - [SkipIfEnvironmentVariableNotEnabled("RUN_RUNTIME_STORE_TESTS")] - [ConditionalFact] - [Trait("smoketests", "usestore")] - public async Task DefaultLocation_Kestrel() - { - var tests = new TestHelper(_output); - await tests.SmokeTestSuite(ServerType.Kestrel); - } - } -} \ No newline at end of file diff --git a/test/MusicStore.E2ETests/SmokeTests_X64.cs b/test/MusicStore.E2ETests/SmokeTests_X64.cs deleted file mode 100644 index 64d0b5b538..0000000000 --- a/test/MusicStore.E2ETests/SmokeTests_X64.cs +++ /dev/null @@ -1,80 +0,0 @@ -using System.Threading.Tasks; -using Microsoft.AspNetCore.Server.IntegrationTesting; -using Microsoft.AspNetCore.Testing.xunit; -using Xunit; -using Xunit.Abstractions; - -namespace E2ETests -{ - [Trait("E2Etests", "Smoke")] - public class SmokeTests_X64 - { - private readonly SmokeTestRunner _smokeTestRunner; - - public SmokeTests_X64(ITestOutputHelper output) - { - _smokeTestRunner = new SmokeTestRunner(output); - } - - [ConditionalFact] - [OSSkipCondition(OperatingSystems.Linux | OperatingSystems.MacOSX)] - public Task SmokeTests_X64_WebListener_Clr() - { - return _smokeTestRunner.SmokeTestSuite(ServerType.WebListener, RuntimeFlavor.Clr, RuntimeArchitecture.x64, ApplicationType.Portable); - } - - [ConditionalFact] - [OSSkipCondition(OperatingSystems.Linux | OperatingSystems.MacOSX)] - public Task SmokeTests_X64_WebListener_CoreClr_Portable() - { - return _smokeTestRunner.SmokeTestSuite(ServerType.WebListener, RuntimeFlavor.CoreClr, RuntimeArchitecture.x64, ApplicationType.Portable); - } - - [ConditionalFact] - [OSSkipCondition(OperatingSystems.Linux | OperatingSystems.MacOSX)] - public Task SmokeTests_X64_WebListener_CoreClr_Standalone() - { - return _smokeTestRunner.SmokeTestSuite(ServerType.WebListener, RuntimeFlavor.CoreClr, RuntimeArchitecture.x64, ApplicationType.Standalone); - } - - [ConditionalFact(Skip = "https://github.com/aspnet/websdk/pull/322")] - [OSSkipCondition(OperatingSystems.Linux | OperatingSystems.MacOSX)] - public Task SmokeTests_X64_IISExpress_Clr() - { - return _smokeTestRunner.SmokeTestSuite(ServerType.IISExpress, RuntimeFlavor.Clr, RuntimeArchitecture.x64, ApplicationType.Portable); - } - - [ConditionalFact] - [OSSkipCondition(OperatingSystems.Linux | OperatingSystems.MacOSX)] - public Task SmokeTests_X64_IISExpress_CoreClr_Portable() - { - return _smokeTestRunner.SmokeTestSuite(ServerType.IISExpress, RuntimeFlavor.CoreClr, RuntimeArchitecture.x64, ApplicationType.Portable); - } - - [ConditionalFact] - [OSSkipCondition(OperatingSystems.Linux | OperatingSystems.MacOSX)] - public Task SmokeTests_X64_IISExpress_CoreClr_Standalone() - { - return _smokeTestRunner.SmokeTestSuite(ServerType.IISExpress, RuntimeFlavor.CoreClr, RuntimeArchitecture.x64, ApplicationType.Standalone); - } - - [ConditionalFact] - [OSSkipCondition(OperatingSystems.Linux | OperatingSystems.MacOSX)] - public Task SmokeTests_X64_Kestrel_Clr() - { - return _smokeTestRunner.SmokeTestSuite(ServerType.Kestrel, RuntimeFlavor.Clr, RuntimeArchitecture.x64, ApplicationType.Portable); - } - - [Fact] - public Task SmokeTests_X64_Kestrel_CoreClr_Portable() - { - return _smokeTestRunner.SmokeTestSuite(ServerType.Kestrel, RuntimeFlavor.CoreClr, RuntimeArchitecture.x64, ApplicationType.Portable); - } - - [Fact] - public Task SmokeTests_X64_Kestrel_CoreClr_Standalone() - { - return _smokeTestRunner.SmokeTestSuite(ServerType.Kestrel, RuntimeFlavor.CoreClr, RuntimeArchitecture.x64, ApplicationType.Standalone); - } - } -} diff --git a/test/MusicStore.E2ETests/SmokeTestsUsingStore/TestHelper.cs b/test/MusicStore.E2ETests/StoreSmokeTests.cs similarity index 84% rename from test/MusicStore.E2ETests/SmokeTestsUsingStore/TestHelper.cs rename to test/MusicStore.E2ETests/StoreSmokeTests.cs index 1d2e8d771e..bf92b0afa0 100644 --- a/test/MusicStore.E2ETests/SmokeTestsUsingStore/TestHelper.cs +++ b/test/MusicStore.E2ETests/StoreSmokeTests.cs @@ -1,32 +1,31 @@ -// 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. -using System; using System.Collections.Generic; using System.IO; using System.Text; 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; using Xunit.Abstractions; -namespace E2ETests.SmokeTestsUsingStore +namespace E2ETests { - public class TestHelper : LoggedTest + public class StoreSmokeTests : LoggedTest { - public TestHelper(ITestOutputHelper output) : base(output) + [SkipIfEnvironmentVariableNotEnabled("RUN_RUNTIME_STORE_TESTS")] + [ConditionalFact] + [Trait("smoketests", "usestore")] + public async Task DefaultLocation_Kestrel() { - } - - public async Task SmokeTestSuite(ServerType serverType) - { - var targetFramework = Helpers.GetTargetFramework(RuntimeFlavor.CoreClr); + var serverType = ServerType.Kestrel; var testName = $"SmokeTestsUsingStore_{serverType}"; using (StartLog(out var loggerFactory, testName)) { - var logger = loggerFactory.CreateLogger(nameof(TestHelper)); + var logger = loggerFactory.CreateLogger(nameof(StoreSmokeTests)); var musicStoreDbName = DbUtils.GetUniqueName(); var deploymentParameters = new DeploymentParameters( @@ -36,8 +35,7 @@ namespace E2ETests.SmokeTestsUsingStore SiteName = "MusicStoreTestSiteUsingStore", PublishApplicationBeforeDeployment = true, PreservePublishedApplicationForDebugging = Helpers.PreservePublishedApplicationForDebugging, - TargetFramework = targetFramework, - Configuration = Helpers.GetCurrentBuildConfiguration(), + TargetFramework = Tfm.NetCoreApp20, // There's only a Store on 2.0 ApplicationType = ApplicationType.Portable, UserAdditionalCleanup = parameters => { @@ -70,7 +68,7 @@ namespace E2ETests.SmokeTestsUsingStore logger.LogInformation($"Published output does not have the dll '{mvcCoreDll}', so the output seems to be trimmed"); - await SmokeTestRunner.RunTestsAsync(deploymentResult, logger); + await SmokeTests.RunTestsAsync(deploymentResult, logger); } } } @@ -96,4 +94,4 @@ namespace E2ETests.SmokeTestsUsingStore return directoryStructure.ToString(); } } -} +} \ No newline at end of file