Move to TestMatrix approach

This commit is contained in:
Chris Ross (ASP.NET) 2018-05-16 09:26:30 -07:00
parent 15b219f55f
commit 0c5be39112
18 changed files with 127 additions and 462 deletions

View File

@ -1,5 +1,8 @@
<Project>
<PropertyGroup>
<!-- This is the one repo where we plan to continue testing all the TFMs for regression coverage. -->
<RuntimeFrameworkVersion Condition=" '$(TargetFramework)' == 'netcoreapp2.0' ">$(MicrosoftNETCoreApp20PackageVersion)</RuntimeFrameworkVersion>
<RuntimeFrameworkVersion Condition=" '$(TargetFramework)' == 'netcoreapp2.1' ">$(MicrosoftNETCoreApp21PackageVersion)</RuntimeFrameworkVersion>
<RuntimeFrameworkVersion Condition=" '$(TargetFramework)' == 'netcoreapp2.2' ">$(MicrosoftNETCoreApp22PackageVersion)</RuntimeFrameworkVersion>
<NETStandardImplicitPackageVersion Condition=" '$(TargetFramework)' == 'netstandard2.0' ">$(NETStandardLibrary20PackageVersion)</NETStandardImplicitPackageVersion>
<!-- aspnet/BuildTools#662 Don't police what version of NetCoreApp we use -->

View File

@ -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

View File

@ -3,39 +3,41 @@
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
</PropertyGroup>
<PropertyGroup Label="Package Versions">
<MicrosoftAspNetCoreAllPackageVersion>2.2.0-preview1-34194</MicrosoftAspNetCoreAllPackageVersion>
<MicrosoftAspNetCoreAspNetCoreModulePackageVersion>2.2.0-preview1-34194</MicrosoftAspNetCoreAspNetCoreModulePackageVersion>
<MicrosoftAspNetCoreAuthenticationCookiesPackageVersion>2.2.0-preview1-34194</MicrosoftAspNetCoreAuthenticationCookiesPackageVersion>
<MicrosoftAspNetCoreAuthenticationCorePackageVersion>2.2.0-preview1-34194</MicrosoftAspNetCoreAuthenticationCorePackageVersion>
<MicrosoftAspNetCoreAuthenticationFacebookPackageVersion>2.2.0-preview1-34194</MicrosoftAspNetCoreAuthenticationFacebookPackageVersion>
<MicrosoftAspNetCoreAuthenticationGooglePackageVersion>2.2.0-preview1-34194</MicrosoftAspNetCoreAuthenticationGooglePackageVersion>
<MicrosoftAspNetCoreAuthenticationMicrosoftAccountPackageVersion>2.2.0-preview1-34194</MicrosoftAspNetCoreAuthenticationMicrosoftAccountPackageVersion>
<MicrosoftAspNetCoreAuthenticationOpenIdConnectPackageVersion>2.2.0-preview1-34194</MicrosoftAspNetCoreAuthenticationOpenIdConnectPackageVersion>
<MicrosoftAspNetCoreAuthenticationTwitterPackageVersion>2.2.0-preview1-34194</MicrosoftAspNetCoreAuthenticationTwitterPackageVersion>
<MicrosoftAspNetCoreDiagnosticsEntityFrameworkCorePackageVersion>2.2.0-preview1-34194</MicrosoftAspNetCoreDiagnosticsEntityFrameworkCorePackageVersion>
<MicrosoftAspNetCoreIdentityEntityFrameworkCorePackageVersion>2.2.0-preview1-34194</MicrosoftAspNetCoreIdentityEntityFrameworkCorePackageVersion>
<MicrosoftAspNetCoreIdentityPackageVersion>2.2.0-preview1-34194</MicrosoftAspNetCoreIdentityPackageVersion>
<MicrosoftAspNetCoreMvcPackageVersion>2.2.0-preview1-34194</MicrosoftAspNetCoreMvcPackageVersion>
<MicrosoftAspNetCoreMvcRazorViewCompilationPackageVersion>2.2.0-preview1-34194</MicrosoftAspNetCoreMvcRazorViewCompilationPackageVersion>
<MicrosoftAspNetCorePackageVersion>2.2.0-preview1-34194</MicrosoftAspNetCorePackageVersion>
<MicrosoftAspNetCoreServerHttpSysPackageVersion>2.2.0-preview1-34194</MicrosoftAspNetCoreServerHttpSysPackageVersion>
<MicrosoftAspNetCoreServerIntegrationTestingPackageVersion>0.6.0-preview1-34194</MicrosoftAspNetCoreServerIntegrationTestingPackageVersion>
<MicrosoftAspNetCoreSessionPackageVersion>2.2.0-preview1-34194</MicrosoftAspNetCoreSessionPackageVersion>
<MicrosoftAspNetCoreStaticFilesPackageVersion>2.2.0-preview1-34194</MicrosoftAspNetCoreStaticFilesPackageVersion>
<MicrosoftAspNetCoreWebUtilitiesPackageVersion>2.2.0-preview1-34194</MicrosoftAspNetCoreWebUtilitiesPackageVersion>
<MicrosoftEntityFrameworkCoreInMemoryPackageVersion>2.2.0-preview1-34194</MicrosoftEntityFrameworkCoreInMemoryPackageVersion>
<MicrosoftEntityFrameworkCoreSqlServerPackageVersion>2.2.0-preview1-34194</MicrosoftEntityFrameworkCoreSqlServerPackageVersion>
<MicrosoftExtensionsCommandLineUtilsSourcesPackageVersion>2.2.0-preview1-34194</MicrosoftExtensionsCommandLineUtilsSourcesPackageVersion>
<MicrosoftExtensionsConfigurationBinderPackageVersion>2.2.0-preview1-34194</MicrosoftExtensionsConfigurationBinderPackageVersion>
<MicrosoftExtensionsConfigurationCommandLinePackageVersion>2.2.0-preview1-34194</MicrosoftExtensionsConfigurationCommandLinePackageVersion>
<MicrosoftExtensionsConfigurationEnvironmentVariablesPackageVersion>2.2.0-preview1-34194</MicrosoftExtensionsConfigurationEnvironmentVariablesPackageVersion>
<MicrosoftExtensionsConfigurationJsonPackageVersion>2.2.0-preview1-34194</MicrosoftExtensionsConfigurationJsonPackageVersion>
<MicrosoftExtensionsConfigurationUserSecretsPackageVersion>2.2.0-preview1-34194</MicrosoftExtensionsConfigurationUserSecretsPackageVersion>
<MicrosoftExtensionsLoggingConsolePackageVersion>2.2.0-preview1-34194</MicrosoftExtensionsLoggingConsolePackageVersion>
<MicrosoftExtensionsLoggingPackageVersion>2.2.0-preview1-34194</MicrosoftExtensionsLoggingPackageVersion>
<MicrosoftExtensionsLoggingTestingPackageVersion>2.2.0-preview1-34194</MicrosoftExtensionsLoggingTestingPackageVersion>
<MicrosoftAspNetCoreAllPackageVersion>2.2.0-preview1-34217</MicrosoftAspNetCoreAllPackageVersion>
<MicrosoftAspNetCoreAspNetCoreModulePackageVersion>2.2.0-preview1-34217</MicrosoftAspNetCoreAspNetCoreModulePackageVersion>
<MicrosoftAspNetCoreAuthenticationCookiesPackageVersion>2.2.0-preview1-34217</MicrosoftAspNetCoreAuthenticationCookiesPackageVersion>
<MicrosoftAspNetCoreAuthenticationCorePackageVersion>2.2.0-preview1-34217</MicrosoftAspNetCoreAuthenticationCorePackageVersion>
<MicrosoftAspNetCoreAuthenticationFacebookPackageVersion>2.2.0-preview1-34217</MicrosoftAspNetCoreAuthenticationFacebookPackageVersion>
<MicrosoftAspNetCoreAuthenticationGooglePackageVersion>2.2.0-preview1-34217</MicrosoftAspNetCoreAuthenticationGooglePackageVersion>
<MicrosoftAspNetCoreAuthenticationMicrosoftAccountPackageVersion>2.2.0-preview1-34217</MicrosoftAspNetCoreAuthenticationMicrosoftAccountPackageVersion>
<MicrosoftAspNetCoreAuthenticationOpenIdConnectPackageVersion>2.2.0-preview1-34217</MicrosoftAspNetCoreAuthenticationOpenIdConnectPackageVersion>
<MicrosoftAspNetCoreAuthenticationTwitterPackageVersion>2.2.0-preview1-34217</MicrosoftAspNetCoreAuthenticationTwitterPackageVersion>
<MicrosoftAspNetCoreDiagnosticsEntityFrameworkCorePackageVersion>2.2.0-preview1-34217</MicrosoftAspNetCoreDiagnosticsEntityFrameworkCorePackageVersion>
<MicrosoftAspNetCoreIdentityEntityFrameworkCorePackageVersion>2.2.0-preview1-34217</MicrosoftAspNetCoreIdentityEntityFrameworkCorePackageVersion>
<MicrosoftAspNetCoreIdentityPackageVersion>2.2.0-preview1-34217</MicrosoftAspNetCoreIdentityPackageVersion>
<MicrosoftAspNetCoreMvcPackageVersion>2.2.0-preview1-34217</MicrosoftAspNetCoreMvcPackageVersion>
<MicrosoftAspNetCoreMvcRazorViewCompilationPackageVersion>2.2.0-preview1-34217</MicrosoftAspNetCoreMvcRazorViewCompilationPackageVersion>
<MicrosoftAspNetCorePackageVersion>2.2.0-preview1-34217</MicrosoftAspNetCorePackageVersion>
<MicrosoftAspNetCoreServerHttpSysPackageVersion>2.2.0-preview1-34217</MicrosoftAspNetCoreServerHttpSysPackageVersion>
<MicrosoftAspNetCoreServerIntegrationTestingPackageVersion>0.6.0-a-preview1-inttesting-17031</MicrosoftAspNetCoreServerIntegrationTestingPackageVersion>
<MicrosoftAspNetCoreSessionPackageVersion>2.2.0-preview1-34217</MicrosoftAspNetCoreSessionPackageVersion>
<MicrosoftAspNetCoreStaticFilesPackageVersion>2.2.0-preview1-34217</MicrosoftAspNetCoreStaticFilesPackageVersion>
<MicrosoftAspNetCoreWebUtilitiesPackageVersion>2.2.0-preview1-34217</MicrosoftAspNetCoreWebUtilitiesPackageVersion>
<MicrosoftEntityFrameworkCoreInMemoryPackageVersion>2.2.0-preview1-34217</MicrosoftEntityFrameworkCoreInMemoryPackageVersion>
<MicrosoftEntityFrameworkCoreSqlServerPackageVersion>2.2.0-preview1-34217</MicrosoftEntityFrameworkCoreSqlServerPackageVersion>
<MicrosoftExtensionsCommandLineUtilsSourcesPackageVersion>2.2.0-preview1-34217</MicrosoftExtensionsCommandLineUtilsSourcesPackageVersion>
<MicrosoftExtensionsConfigurationBinderPackageVersion>2.2.0-preview1-34217</MicrosoftExtensionsConfigurationBinderPackageVersion>
<MicrosoftExtensionsConfigurationCommandLinePackageVersion>2.2.0-preview1-34217</MicrosoftExtensionsConfigurationCommandLinePackageVersion>
<MicrosoftExtensionsConfigurationEnvironmentVariablesPackageVersion>2.2.0-preview1-34217</MicrosoftExtensionsConfigurationEnvironmentVariablesPackageVersion>
<MicrosoftExtensionsConfigurationJsonPackageVersion>2.2.0-preview1-34217</MicrosoftExtensionsConfigurationJsonPackageVersion>
<MicrosoftExtensionsConfigurationUserSecretsPackageVersion>2.2.0-preview1-34217</MicrosoftExtensionsConfigurationUserSecretsPackageVersion>
<MicrosoftExtensionsLoggingConsolePackageVersion>2.2.0-preview1-34217</MicrosoftExtensionsLoggingConsolePackageVersion>
<MicrosoftExtensionsLoggingPackageVersion>2.2.0-preview1-34217</MicrosoftExtensionsLoggingPackageVersion>
<MicrosoftExtensionsLoggingTestingPackageVersion>2.2.0-preview1-34217</MicrosoftExtensionsLoggingTestingPackageVersion>
<MicrosoftNETCoreApp20PackageVersion>2.0.0</MicrosoftNETCoreApp20PackageVersion>
<MicrosoftNETCoreApp21PackageVersion>2.1.0-rc1</MicrosoftNETCoreApp21PackageVersion>
<MicrosoftNETCoreApp22PackageVersion>2.2.0-preview1-26509-06</MicrosoftNETCoreApp22PackageVersion>
<MicrosoftNETSdkRazorPackageVersion>2.2.0-preview1-34194</MicrosoftNETSdkRazorPackageVersion>
<MicrosoftNETSdkRazorPackageVersion>2.2.0-preview1-34217</MicrosoftNETSdkRazorPackageVersion>
<MicrosoftNETTestSdkPackageVersion>15.6.1</MicrosoftNETTestSdkPackageVersion>
<NETStandardLibrary20PackageVersion>2.0.3</NETStandardLibrary20PackageVersion>
<SystemDataSqlClientPackageVersion>4.6.0-preview1-26508-04</SystemDataSqlClientPackageVersion>

View File

@ -8,6 +8,8 @@
</PropertyGroup>
<ItemGroup>
<DotNetCoreRuntime Include="$(MicrosoftNETCoreApp20PackageVersion)" />
<DotNetCoreRuntime Include="$(MicrosoftNETCoreApp21PackageVersion)" />
<DotNetCoreRuntime Include="$(MicrosoftNETCoreApp22PackageVersion)" />
</ItemGroup>
</Project>

View File

@ -2,7 +2,7 @@
<PropertyGroup>
<Description>Music store application on ASP.NET Core</Description>
<TargetFrameworks>netcoreapp2.2;net461</TargetFrameworks>
<TargetFrameworks>netcoreapp2.2;netcoreapp2.1;netcoreapp2.0;net461</TargetFrameworks>
<DefineConstants>$(DefineConstants);DEMO</DefineConstants>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<RuntimeIdentifiers Condition="'$(Configuration)' != 'RuntimeStore'">win7-x86;win7-x64;linux-x64;osx-x64</RuntimeIdentifiers>

View File

@ -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}.");
}
}
}

View File

@ -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);

View File

@ -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);
}
}

View File

@ -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 =>
{

View File

@ -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 =>
{

View File

@ -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)

View File

@ -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);
}
}

View File

@ -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);
}
}

View File

@ -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);

View File

@ -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);
}
}
}

View File

@ -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);
}
}
}

View File

@ -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);
}
}
}

View File

@ -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();
}
}
}
}