Add forwards compat tests (#1547)

This commit is contained in:
Justin Kotalik 2018-10-23 12:53:31 -07:00 committed by GitHub
parent 3842779379
commit f7e8255ece
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
26 changed files with 303 additions and 82 deletions

View File

@ -16,7 +16,7 @@ install:
- git submodule update --init --recursive
- net start w3svc
build_script:
- ps: .\run.ps1 default-build /p:SkipIISBackwardsCompatibilityTests=true
- ps: .\run.ps1 default-build /p:SkipIISBackwardsCompatibilityTests=true /p:SkipIISForwardsCompatibilityTests=true
clone_depth: 1
environment:
global:

View File

@ -13,7 +13,7 @@ phases:
parameters:
agentOs: Windows
codeSign: false
buildArgs: /p:BuildServerIIS21=true /p:SkipIISExpressTests=true /p:SkipIISBackwardsCompatibilityTests=true
buildArgs: /p:BuildServerIIS21=true /p:SkipIISExpressTests=true /p:SkipIISBackwardsCompatibilityTests=true /p:SkipIISForwardsCompatibilityTests=true
beforeBuild:
- powershell: "& ./tools/UpdateIISExpressCertificate.ps1; & ./tools/update_schema.ps1; & ./tools/SetupTestEnvironment.ps1 SetupDumps"
displayName: Prepare repo

View File

@ -3,7 +3,7 @@ phases:
parameters:
agentOs: Windows
phaseName: IIS_Express_Tests
buildArgs: /p:SkipIISBackwardsCompatibilityTests=true /p:SkipIISTests=true
buildArgs: /p:SkipIISBackwardsCompatibilityTests=true /p:SkipIISTests=true /p:SkipIISForwardsCompatibilityTests=true
beforeBuild:
- powershell: "& ./tools/UpdateIISExpressCertificate.ps1; & ./tools/update_schema.ps1; & ./tools/SetupTestEnvironment.ps1 Setup"
displayName: Prepare repo
@ -23,7 +23,7 @@ phases:
parameters:
agentOs: Windows
phaseName: IIS_Tests
buildArgs: /p:SkipIISBackwardsCompatibilityTests=true /p:SkipIISExpressTests=true
buildArgs: /p:SkipIISBackwardsCompatibilityTests=true /p:SkipIISExpressTests=true /p:SkipIISForwardsCompatibilityTests=true
beforeBuild:
- powershell: "& ./tools/UpdateIISExpressCertificate.ps1; & ./tools/update_schema.ps1; & ./tools/SetupTestEnvironment.ps1 Setup"
displayName: Prepare repo
@ -43,7 +43,27 @@ phases:
parameters:
agentOs: Windows
phaseName: IIS_BackCompat_Tests
buildArgs: /p:SkipIISTests=true /p:SkipIISExpressTests=true
buildArgs: /p:SkipIISTests=true /p:SkipIISExpressTests=true /p:SkipIISForwardsCompatibilityTests=true
beforeBuild:
- powershell: "& ./tools/UpdateIISExpressCertificate.ps1; & ./tools/update_schema.ps1; & ./tools/SetupTestEnvironment.ps1 Setup"
displayName: Prepare repo
afterBuild:
- powershell: "& ./tools/SetupTestEnvironment.ps1 Shutdown"
displayName: Stop AppVerifier
condition: always()
- task: PublishBuildArtifacts@1
displayName: Upload logs
condition: eq(variables['system.pullrequest.isfork'], false)
inputs:
artifactName: logs
artifactType: Container
pathtoPublish: artifacts/logs
- template: .vsts-pipelines/templates/phases/default-build.yml@buildtools
parameters:
agentOs: Windows
phaseName: IIS_ForwardsCompat_Tests
buildArgs: /p:SkipIISTests=true /p:SkipIISExpressTests=true /p:SkipIISBackwardsCompatibilityTests=true
beforeBuild:
- powershell: "& ./tools/UpdateIISExpressCertificate.ps1; & ./tools/update_schema.ps1; & ./tools/SetupTestEnvironment.ps1 Setup"
displayName: Prepare repo

View File

@ -115,6 +115,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Common.Tests", "test\Common
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IIS.BackwardsCompatibility.FunctionalTests", "test\IIS.BackwardsCompatibility.FunctionalTests\IIS.BackwardsCompatibility.FunctionalTests.csproj", "{582B07BC-73F4-4689-8557-B039298BD82C}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IIS.ForwardsCompatibility.FunctionalTests", "test\IIS.ForwardsCompatibility.FunctionalTests\IIS.ForwardsCompatibility.FunctionalTests.csproj", "{D1EA5D99-28FD-4197-81DE-17098846B38B}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "InProcessForwardsCompatWebSite", "test\WebSites\InProcessForwardsCompatWebSite\InProcessWebSite.csproj", "{BBBC85B2-5D7A-4D09-90B1-8DBCC9059493}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -397,6 +401,28 @@ Global
{582B07BC-73F4-4689-8557-B039298BD82C}.Release|x64.Build.0 = Release|Any CPU
{582B07BC-73F4-4689-8557-B039298BD82C}.Release|x86.ActiveCfg = Release|Any CPU
{582B07BC-73F4-4689-8557-B039298BD82C}.Release|x86.Build.0 = Release|Any CPU
{D1EA5D99-28FD-4197-81DE-17098846B38B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D1EA5D99-28FD-4197-81DE-17098846B38B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D1EA5D99-28FD-4197-81DE-17098846B38B}.Debug|x64.ActiveCfg = Debug|Any CPU
{D1EA5D99-28FD-4197-81DE-17098846B38B}.Debug|x64.Build.0 = Debug|Any CPU
{D1EA5D99-28FD-4197-81DE-17098846B38B}.Debug|x86.ActiveCfg = Debug|Any CPU
{D1EA5D99-28FD-4197-81DE-17098846B38B}.Debug|x86.Build.0 = Debug|Any CPU
{D1EA5D99-28FD-4197-81DE-17098846B38B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D1EA5D99-28FD-4197-81DE-17098846B38B}.Release|Any CPU.Build.0 = Release|Any CPU
{D1EA5D99-28FD-4197-81DE-17098846B38B}.Release|x64.ActiveCfg = Release|Any CPU
{D1EA5D99-28FD-4197-81DE-17098846B38B}.Release|x64.Build.0 = Release|Any CPU
{D1EA5D99-28FD-4197-81DE-17098846B38B}.Release|x86.ActiveCfg = Release|Any CPU
{D1EA5D99-28FD-4197-81DE-17098846B38B}.Release|x86.Build.0 = Release|Any CPU
{BBBC85B2-5D7A-4D09-90B1-8DBCC9059493}.Debug|Any CPU.ActiveCfg = Debug|x86
{BBBC85B2-5D7A-4D09-90B1-8DBCC9059493}.Debug|x64.ActiveCfg = Debug|x64
{BBBC85B2-5D7A-4D09-90B1-8DBCC9059493}.Debug|x64.Build.0 = Debug|x64
{BBBC85B2-5D7A-4D09-90B1-8DBCC9059493}.Debug|x86.ActiveCfg = Debug|x86
{BBBC85B2-5D7A-4D09-90B1-8DBCC9059493}.Debug|x86.Build.0 = Debug|x86
{BBBC85B2-5D7A-4D09-90B1-8DBCC9059493}.Release|Any CPU.ActiveCfg = Release|x86
{BBBC85B2-5D7A-4D09-90B1-8DBCC9059493}.Release|x64.ActiveCfg = Release|x64
{BBBC85B2-5D7A-4D09-90B1-8DBCC9059493}.Release|x64.Build.0 = Release|x64
{BBBC85B2-5D7A-4D09-90B1-8DBCC9059493}.Release|x86.ActiveCfg = Release|x86
{BBBC85B2-5D7A-4D09-90B1-8DBCC9059493}.Release|x86.Build.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@ -428,6 +454,8 @@ Global
{C0310D84-BC2F-4B2E-870E-D35044DB3E3E} = {EF30B533-D715-421A-92B7-92FEF460AC9C}
{D17B7B35-5361-4A50-B499-E03E5C3CC095} = {EF30B533-D715-421A-92B7-92FEF460AC9C}
{582B07BC-73F4-4689-8557-B039298BD82C} = {EF30B533-D715-421A-92B7-92FEF460AC9C}
{D1EA5D99-28FD-4197-81DE-17098846B38B} = {EF30B533-D715-421A-92B7-92FEF460AC9C}
{BBBC85B2-5D7A-4D09-90B1-8DBCC9059493} = {744ACDC6-F6A0-4FF9-9421-F25C5F2DC520}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {DB4F868D-E1AE-4FD7-9333-69FA15B268C5}

View File

@ -123,6 +123,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Common.Tests", "test\Common
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IIS.BackwardsCompatibility.FunctionalTests", "test\IIS.BackwardsCompatibility.FunctionalTests\IIS.BackwardsCompatibility.FunctionalTests.csproj", "{28055B05-25D4-4F17-9F36-A1D09FDDA607}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IIS.ForwardsCompatibility.FunctionalTests", "test\IIS.ForwardsCompatibility.FunctionalTests\IIS.ForwardsCompatibility.FunctionalTests.csproj", "{F6FAA65F-AA29-4DDA-AA89-C16AF4A69F9F}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "InProcessForwardsCompatWebSite", "test\WebSites\InProcessForwardsCompatWebSite\InProcessWebSite.csproj", "{980DAB60-6471-46EC-82EE-B457D91C3789}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -659,6 +663,42 @@ Global
{28055B05-25D4-4F17-9F36-A1D09FDDA607}.Release|x64.Build.0 = Release|Any CPU
{28055B05-25D4-4F17-9F36-A1D09FDDA607}.Release|x86.ActiveCfg = Release|Any CPU
{28055B05-25D4-4F17-9F36-A1D09FDDA607}.Release|x86.Build.0 = Release|Any CPU
{F6FAA65F-AA29-4DDA-AA89-C16AF4A69F9F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F6FAA65F-AA29-4DDA-AA89-C16AF4A69F9F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F6FAA65F-AA29-4DDA-AA89-C16AF4A69F9F}.Debug|x64.ActiveCfg = Debug|Any CPU
{F6FAA65F-AA29-4DDA-AA89-C16AF4A69F9F}.Debug|x86.ActiveCfg = Debug|Any CPU
{F6FAA65F-AA29-4DDA-AA89-C16AF4A69F9F}.NativeDebug|Any CPU.ActiveCfg = Debug|Any CPU
{F6FAA65F-AA29-4DDA-AA89-C16AF4A69F9F}.NativeDebug|Any CPU.Build.0 = Debug|Any CPU
{F6FAA65F-AA29-4DDA-AA89-C16AF4A69F9F}.NativeDebug|x64.ActiveCfg = Debug|Any CPU
{F6FAA65F-AA29-4DDA-AA89-C16AF4A69F9F}.NativeDebug|x86.ActiveCfg = Debug|Any CPU
{F6FAA65F-AA29-4DDA-AA89-C16AF4A69F9F}.NativeRelease|Any CPU.ActiveCfg = Release|Any CPU
{F6FAA65F-AA29-4DDA-AA89-C16AF4A69F9F}.NativeRelease|Any CPU.Build.0 = Release|Any CPU
{F6FAA65F-AA29-4DDA-AA89-C16AF4A69F9F}.NativeRelease|x64.ActiveCfg = Release|Any CPU
{F6FAA65F-AA29-4DDA-AA89-C16AF4A69F9F}.NativeRelease|x86.ActiveCfg = Release|Any CPU
{F6FAA65F-AA29-4DDA-AA89-C16AF4A69F9F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F6FAA65F-AA29-4DDA-AA89-C16AF4A69F9F}.Release|Any CPU.Build.0 = Release|Any CPU
{F6FAA65F-AA29-4DDA-AA89-C16AF4A69F9F}.Release|x64.ActiveCfg = Release|Any CPU
{F6FAA65F-AA29-4DDA-AA89-C16AF4A69F9F}.Release|x64.Build.0 = Release|Any CPU
{F6FAA65F-AA29-4DDA-AA89-C16AF4A69F9F}.Release|x86.ActiveCfg = Release|Any CPU
{F6FAA65F-AA29-4DDA-AA89-C16AF4A69F9F}.Release|x86.Build.0 = Release|Any CPU
{980DAB60-6471-46EC-82EE-B457D91C3789}.Debug|Any CPU.ActiveCfg = Debug|x86
{980DAB60-6471-46EC-82EE-B457D91C3789}.Debug|x64.ActiveCfg = Debug|x64
{980DAB60-6471-46EC-82EE-B457D91C3789}.Debug|x64.Build.0 = Debug|x64
{980DAB60-6471-46EC-82EE-B457D91C3789}.Debug|x86.ActiveCfg = Debug|x86
{980DAB60-6471-46EC-82EE-B457D91C3789}.Debug|x86.Build.0 = Debug|x86
{980DAB60-6471-46EC-82EE-B457D91C3789}.NativeDebug|Any CPU.ActiveCfg = Release|x64
{980DAB60-6471-46EC-82EE-B457D91C3789}.NativeDebug|Any CPU.Build.0 = Release|x64
{980DAB60-6471-46EC-82EE-B457D91C3789}.NativeDebug|x64.ActiveCfg = Debug|x64
{980DAB60-6471-46EC-82EE-B457D91C3789}.NativeDebug|x86.ActiveCfg = Debug|x86
{980DAB60-6471-46EC-82EE-B457D91C3789}.NativeRelease|Any CPU.ActiveCfg = Release|x64
{980DAB60-6471-46EC-82EE-B457D91C3789}.NativeRelease|Any CPU.Build.0 = Release|x64
{980DAB60-6471-46EC-82EE-B457D91C3789}.NativeRelease|x64.ActiveCfg = Release|x64
{980DAB60-6471-46EC-82EE-B457D91C3789}.NativeRelease|x86.ActiveCfg = Release|x86
{980DAB60-6471-46EC-82EE-B457D91C3789}.Release|Any CPU.ActiveCfg = Release|x86
{980DAB60-6471-46EC-82EE-B457D91C3789}.Release|x64.ActiveCfg = Release|x64
{980DAB60-6471-46EC-82EE-B457D91C3789}.Release|x64.Build.0 = Release|x64
{980DAB60-6471-46EC-82EE-B457D91C3789}.Release|x86.ActiveCfg = Release|x86
{980DAB60-6471-46EC-82EE-B457D91C3789}.Release|x86.Build.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@ -693,6 +733,8 @@ Global
{A091777D-66B3-42E1-B95C-85322DE40706} = {EF30B533-D715-421A-92B7-92FEF460AC9C}
{A641A208-2974-4E48-BCFF-54E3AAFA4FB9} = {EF30B533-D715-421A-92B7-92FEF460AC9C}
{28055B05-25D4-4F17-9F36-A1D09FDDA607} = {EF30B533-D715-421A-92B7-92FEF460AC9C}
{F6FAA65F-AA29-4DDA-AA89-C16AF4A69F9F} = {EF30B533-D715-421A-92B7-92FEF460AC9C}
{980DAB60-6471-46EC-82EE-B457D91C3789} = {744ACDC6-F6A0-4FF9-9421-F25C5F2DC520}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {DB4F868D-E1AE-4FD7-9333-69FA15B268C5}

View File

@ -10,6 +10,6 @@ simpleNode('Windows.10.Amd64.EnterpriseRS3.ASPNET.Open') {
stage ('Build') {
def logFolder = getLogFolder()
def environment = "\$env:ASPNETCORE_TEST_LOG_DIR='${WORKSPACE}\\${logFolder}'"
bat "powershell -NoProfile -NoLogo -ExecutionPolicy unrestricted -Command \"${environment};&.\\tools\\SetupTestEnvironment.ps1 SetupDumps;&.\\tools\\update_schema.ps1;&.\\tools\\UpdateIISExpressCertificate.ps1;&.\\run.cmd -CI default-build /p:SkipIISBackwardsCompatibilityTests=true /p:Configuration=${params.Configuration}\";"
bat "powershell -NoProfile -NoLogo -ExecutionPolicy unrestricted -Command \"${environment};&.\\tools\\SetupTestEnvironment.ps1 SetupDumps;&.\\tools\\update_schema.ps1;&.\\tools\\UpdateIISExpressCertificate.ps1;&.\\run.cmd -CI default-build /p:SkipIISBackwardsCompatibilityTests=true /p:SkipIISForwardsCompatibilityTests=true /p:Configuration=${params.Configuration}\";"
}
}

View File

@ -1,4 +1,4 @@
<Project>
<Project>
<PropertyGroup>
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
</PropertyGroup>
@ -56,8 +56,9 @@
<PropertyGroup Label="Package Versions: Pinned" />
<Import Project="$(DotNetPackageVersionPropsPath)" Condition=" '$(DotNetPackageVersionPropsPath)' != '' " />
<PropertyGroup Label="Package Versions: Backward compatibility" >
<MicrosoftAspNetCoreAspNetCoreModulePackageVersion>2.2.0-preview3-35458</MicrosoftAspNetCoreAspNetCoreModulePackageVersion>
<MicrosoftAspNetCoreAspNetCoreModuleV2PackageVersion>2.2.0-preview3-35458</MicrosoftAspNetCoreAspNetCoreModuleV2PackageVersion>
<MicrosoftAspNetCoreAspNetCoreModulePackageVersion>2.2.0-preview3-35504</MicrosoftAspNetCoreAspNetCoreModulePackageVersion>
<MicrosoftAspNetCoreAspNetCoreModuleV2PackageVersion>2.2.0-preview3-35504</MicrosoftAspNetCoreAspNetCoreModuleV2PackageVersion>
<MicrosoftAspNetCoreServerIISPackageVersion>2.2.0-preview3-35504</MicrosoftAspNetCoreServerIISPackageVersion>
</PropertyGroup>
<PropertyGroup Label="Package Versions: 2.1 build" >
<MicrosoftAspNetCoreAuthenticationCore21PackageVersion>2.1.0</MicrosoftAspNetCoreAuthenticationCore21PackageVersion>

View File

@ -24,6 +24,10 @@
<ExcludeFromTest Include="$(RepositoryRoot)test\IIS.BackwardsCompatibility.FunctionalTests\*.csproj" />
</ItemGroup>
<ItemGroup Condition="'$(SkipIISForwardsCompatibilityTests)' == 'true'" >
<ExcludeFromTest Include="$(RepositoryRoot)test\IIS.ForwardsCompatibility.FunctionalTests\*.csproj" />
</ItemGroup>
<PropertyGroup>
<!-- These properties are use by the automation that updates dependencies.props -->
<LineupPackageId>Internal.AspNetCore.Universe.Lineup</LineupPackageId>

View File

@ -82,6 +82,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
[ConditionalFact]
[RequiresIIS(IISCapability.PoolEnvironmentVariables)]
[RequiresNewHandler]
public async Task IncludesAdditionalErrorPageTextInProcessStartupFailure_CorrectString()
{
var deploymentParameters = _fixture.GetBaseDeploymentParameters(publish: true);

View File

@ -233,7 +233,14 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
await AssertSiteFailsToStartWithInProcessStaticContent(deploymentResult);
EventLogHelpers.VerifyEventLogEvent(deploymentResult, EventLogHelpers.InProcessFailedToFindRequestHandler(deploymentResult), Logger);
if (DeployerSelector.IsForwardsCompatibilityTest)
{
EventLogHelpers.VerifyEventLogEvent(deploymentResult, EventLogHelpers.InProcessFailedToFindNativeDependencies(deploymentResult), Logger);
}
else
{
EventLogHelpers.VerifyEventLogEvent(deploymentResult, EventLogHelpers.InProcessFailedToFindRequestHandler(deploymentResult), Logger);
}
}
[ConditionalFact]

View File

@ -2,16 +2,15 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using Microsoft.AspNetCore.Server.IntegrationTesting;
using Microsoft.AspNetCore.Testing.xunit;
namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
{
[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Class | AttributeTargets.Method)]
public sealed class RequiresNewShimAttribute : Attribute, ITestCondition
public sealed class RequiresNewHandlerAttribute : Attribute, ITestCondition
{
public bool IsMet => true;
public bool IsMet => !DeployerSelector.IsForwardsCompatibilityTest;
public string SkipReason => "IIS.FunctionalTests always run against new shim.";
public string SkipReason => "Test verifies new behavior in the aspnetcorev2_inprocess.dll that isn't supported in earlier versions.";
}
}

View File

@ -2,7 +2,6 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using Microsoft.AspNetCore.Server.IntegrationTesting;
using Microsoft.AspNetCore.Testing.xunit;
namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
@ -10,7 +9,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Class | AttributeTargets.Method)]
public sealed class RequiresNewShimAttribute : Attribute, ITestCondition
{
public bool IsMet => false;
public bool IsMet => !DeployerSelector.IsBackwardsCompatiblityTest;
public string SkipReason => "Test verifies new behavior in the aspnetcorev2.dll that isn't supported in earlier versions.";
}

View File

@ -28,7 +28,10 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
return Path.Combine(TestPathUtilities.GetSolutionRootDirectory("IISIntegration"),"test", "WebSites", name);
}
public static string GetInProcessTestSitesPath() => GetTestWebSitePath("InProcessWebSite");
public static string GetInProcessTestSitesPath()
{
return DeployerSelector.IsForwardsCompatibilityTest ? GetTestWebSitePath("InProcessForwardsCompatWebSite") : GetTestWebSitePath("InProcessWebSite");
}
public static string GetOutOfProcessTestSitesPath() => GetTestWebSitePath("OutOfProcessWebSite");

View File

@ -1,24 +1,20 @@
// 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.Diagnostics;
using System.IO;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Server.IIS.FunctionalTests.Utilities;
using Microsoft.AspNetCore.Server.IntegrationTesting;
using Microsoft.AspNetCore.Testing.xunit;
using Xunit;
using Xunit.Sdk;
namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
{
[Collection(PublishedSitesCollection.Name)]
public class BackwardsCompatibilityTests : IISFunctionalTestBase
[Collection(IISTestSiteCollection.Name)]
public class BackwardsCompatibilityTests : FixtureLoggedTest
{
private readonly PublishedSitesFixture _fixture;
private readonly IISTestSiteFixture _fixture;
public BackwardsCompatibilityTests(PublishedSitesFixture fixture)
public BackwardsCompatibilityTests(IISTestSiteFixture fixture) : base(fixture)
{
_fixture = fixture;
}
@ -26,24 +22,18 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
[ConditionalFact]
public async Task CheckBackwardsCompatibilityIsUsed()
{
var iisDeploymentParameters = _fixture.GetBaseDeploymentParameters(publish: true);
iisDeploymentParameters.PreservePublishedApplicationForDebugging = true;
var deploymentResult = await DeployAsync(iisDeploymentParameters);
var response = await _fixture.Client.GetAsync("/HelloWorld");
var handles = _fixture.DeploymentResult.HostProcess.Modules;
var arch = iisDeploymentParameters.RuntimeArchitecture == RuntimeArchitecture.x64 ? $@"x64\aspnetcorev2.dll" : $@"x86\aspnetcorev2.dll";
var fileInfo = FileVersionInfo.GetVersionInfo(Path.Combine(AppContext.BaseDirectory, arch));
var response = await deploymentResult.HttpClient.GetAsync("/HelloWorld");
var handles = deploymentResult.HostProcess.Modules;
foreach (ProcessModule handle in handles)
{
if (handle.ModuleName == "aspnetcorev2.dll")
{
Assert.Equal("12.2.18283.0", handle.FileVersionInfo.FileVersion);
Assert.Equal("12.2.18289.0", handle.FileVersionInfo.FileVersion);
return;
}
}
throw new XunitException($"Could not find aspnetcorev2.dll loaded in process {deploymentResult.HostProcess.ProcessName}");
throw new XunitException($"Could not find aspnetcorev2.dll loaded in process {_fixture.DeploymentResult.HostProcess.ProcessName}");
}
}
}

View File

@ -9,5 +9,6 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
{
public static ServerType ServerType => ServerType.IIS;
public static bool IsBackwardsCompatiblityTest => true;
public static bool IsForwardsCompatibilityTest => false;
}
}

View File

@ -43,14 +43,4 @@
<PackageReference Include="xunit.runner.visualstudio" Version="$(XunitRunnerVisualStudioPackageVersion)" />
</ItemGroup>
<ItemGroup>
<None Remove="AppHostConfig\HostableWebCore.config" />
</ItemGroup>
<ItemGroup>
<Content Update="AppHostConfig\HostableWebCore.config">
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
</Content>
</ItemGroup>
</Project>

View File

@ -0,0 +1,14 @@
// 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 Microsoft.AspNetCore.Server.IntegrationTesting;
namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
{
public static class DeployerSelector
{
public static ServerType ServerType => ServerType.IIS;
public static bool IsBackwardsCompatiblityTest => false;
public static bool IsForwardsCompatibilityTest => true;
}
}

View File

@ -0,0 +1,38 @@
// 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.Diagnostics;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Testing.xunit;
using Xunit;
using Xunit.Sdk;
namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
{
[Collection(IISTestSiteCollection.Name)]
public class ForwardsCompatibilityTests : FixtureLoggedTest
{
private readonly IISTestSiteFixture _fixture;
public ForwardsCompatibilityTests(IISTestSiteFixture fixture) : base(fixture)
{
_fixture = fixture;
}
[ConditionalFact]
public async Task CheckForwardsCompatibilityIsUsed()
{
var response = await _fixture.Client.GetAsync("/HelloWorld");
var handles = _fixture.DeploymentResult.HostProcess.Modules;
foreach (ProcessModule handle in handles)
{
if (handle.ModuleName == "aspnetcorev2_inprocess.dll")
{
Assert.Equal("12.2.18289.0", handle.FileVersionInfo.FileVersion);
return;
}
}
throw new XunitException($"Could not find aspnetcorev2_inprocess.dll loaded in process {_fixture.DeploymentResult.HostProcess.ProcessName}");
}
}
}

View File

@ -0,0 +1,45 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netcoreapp2.2</TargetFrameworks>
<TestGroupName>IISForwardsCompatibility.FunctionalTests</TestGroupName>
<DisableFastUpToDateCheck>True</DisableFastUpToDateCheck>
</PropertyGroup>
<ItemGroup>
<Content Include="..\Common.FunctionalTests\AppHostConfig\*.config" CopyToOutputDirectory="PreserveNewest" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Common.Tests\Common.Tests.csproj" />
<ProjectReference Include="..\WebSites\InProcessForwardsCompatWebSite\InProcessWebSite.csproj">
<ReferenceOutputAssembly>False</ReferenceOutputAssembly>
</ProjectReference>
<ProjectReference Include="..\WebSites\OutOfProcessWebSite\OutOfProcessWebSite.csproj">
<ReferenceOutputAssembly>False</ReferenceOutputAssembly>
</ProjectReference>
<ProjectReference Include="..\WebSites\StressTestWebSite\StressTestWebSite.csproj">
<ReferenceOutputAssembly>False</ReferenceOutputAssembly>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Compile Include="..\Common.FunctionalTests\**\*.cs" />
<Compile Include="..\IIS.Shared.FunctionalTests\**\*.cs" />
</ItemGroup>
<Import Project="..\..\build\functional-test-assets.targets" />
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Server.IntegrationTesting" Version="$(MicrosoftAspNetCoreServerIntegrationTestingPackageVersion)" />
<PackageReference Include="Microsoft.AspNetCore.Hosting" Version="$(MicrosoftAspNetCoreHostingPackageVersion)" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="$(MicrosoftExtensionsLoggingPackageVersion)" />
<PackageReference Include="Microsoft.Extensions.Logging.Testing" Version="$(MicrosoftExtensionsLoggingTestingPackageVersion)" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="$(MicrosoftNETTestSdkPackageVersion)" />
<PackageReference Include="System.Diagnostics.EventLog" Version="$(SystemDiagnosticsEventLogPackageVersion)" />
<PackageReference Include="System.Net.WebSockets.WebSocketProtocol" Version="$(SystemNetWebSocketsWebSocketProtocolPackageVersion)" />
<PackageReference Include="xunit" Version="$(XunitPackageVersion)" />
<PackageReference Include="xunit.runner.visualstudio" Version="$(XunitRunnerVisualStudioPackageVersion)" />
</ItemGroup>
</Project>

View File

@ -9,5 +9,6 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
{
public static ServerType ServerType => ServerType.IIS;
public static bool IsBackwardsCompatiblityTest => false;
public static bool IsForwardsCompatibilityTest => false;
}
}

View File

@ -43,14 +43,4 @@
<PackageReference Include="xunit.runner.visualstudio" Version="$(XunitRunnerVisualStudioPackageVersion)" />
</ItemGroup>
<ItemGroup>
<None Remove="AppHostConfig\HostableWebCore.config" />
</ItemGroup>
<ItemGroup>
<Content Update="AppHostConfig\HostableWebCore.config">
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
</Content>
</ItemGroup>
</Project>

View File

@ -9,5 +9,6 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
{
public static ServerType ServerType => ServerType.IISExpress;
public static bool IsBackwardsCompatiblityTest => false;
public static bool IsForwardsCompatibilityTest => false;
}
}

View File

@ -35,14 +35,4 @@
<PackageReference Include="xunit.runner.visualstudio" Version="$(XunitRunnerVisualStudioPackageVersion)" />
</ItemGroup>
<ItemGroup>
<None Remove="AppHostConfig\HostableWebCore.config" />
</ItemGroup>
<ItemGroup>
<Content Update="AppHostConfig\HostableWebCore.config">
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
</Content>
</ItemGroup>
</Project>

View File

@ -1,17 +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 Microsoft.AspNetCore.Server.IntegrationTesting;
using Microsoft.AspNetCore.Testing.xunit;
namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
{
[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Class | AttributeTargets.Method)]
public sealed class RequiresNewShimAttribute : Attribute, ITestCondition
{
public bool IsMet => true;
public string SkipReason => "IISExpress.FunctionalTests always run against new shim.";
}
}

View File

@ -0,0 +1,32 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<Import Project="..\..\..\build\testsite.props" />
<PropertyGroup>
<TargetFrameworks>netcoreapp2.2</TargetFrameworks>
</PropertyGroup>
<ItemGroup>
<Compile Include="..\shared\**\*.cs" />
<Compile Include="..\InProcessWebSite\*.cs" />
<Compile Include="..\InProcessWebSite\Properties\*.cs" />
<None Include="..\InProcessWebSite\web.config" CopyToOutputDirectory="Always" />
</ItemGroup>
<ItemGroup>
<None Include="wwwroot\**" CopyToOutputDirectory="Always" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Server.IIS" Version="$(MicrosoftAspNetCoreServerIISPackageVersion)" />
<PackageReference Include="Microsoft.AspNetCore.ResponseCompression" Version="$(MicrosoftAspNetCoreResponseCompressionPackageVersion)" />
<PackageReference Include="Microsoft.AspNetCore.Hosting" Version="$(MicrosoftAspNetCoreHostingPackageVersion)" />
<PackageReference Include="Microsoft.AspNetCore.WebUtilities" Version="$(MicrosoftAspNetCoreWebUtilitiesPackageVersion)" />
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="$(MicrosoftExtensionsConfigurationEnvironmentVariablesPackageVersion)" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="$(MicrosoftExtensionsConfigurationJsonPackageVersion)" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="$(MicrosoftExtensionsLoggingConsolePackageVersion)" />
<PackageReference Include="System.Net.WebSockets.WebSocketProtocol" Version="$(SystemNetWebSocketsWebSocketProtocolPackageVersion)" />
<PackageReference Include="xunit" Version="$(XunitPackageVersion)" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,42 @@
{
"iisSettings": {
"windowsAuthentication": true,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:5762/",
"sslPort": 0
}
},
"profiles": {
"ANCM IIS Express": {
"commandName": "Executable",
"executablePath": "$(IISExpressPath)",
"commandLineArgs": "$(IISExpressArguments)",
"environmentVariables": {
"IIS_SITE_PATH": "$(MSBuildThisFileDirectory)",
"ANCM_PATH": "$(AspNetCoreModuleV1ShimDll)",
"ANCMV2_PATH": "$(AspNetCoreModuleV2ShimDll)",
"ANCM_OUTOFPROCESS_HANDLER": "$(AspNetCoreModuleV2OutOfProcessHandlerDll)",
"LAUNCHER_ARGS": "$(TargetPath)",
"ASPNETCORE_ENVIRONMENT": "Development",
"LAUNCHER_PATH": "$(DotNetPath)",
"ASPNETCORE_MODULE_DEBUG": "console"
}
},
"ANCM IIS": {
"commandName": "Executable",
"executablePath": "$(IISPath)",
"commandLineArgs": "$(IISArguments)",
"environmentVariables": {
"IIS_SITE_PATH": "$(MSBuildThisFileDirectory)",
"ANCM_PATH": "$(AspNetCoreModuleV1ShimDll)",
"ANCMV2_PATH": "$(AspNetCoreModuleV2ShimDll)",
"ASPNETCORE_MODULE_OUTOFPROCESS_HANDLER": "$(AspNetCoreModuleV2OutOfProcessHandlerDll)",
"LAUNCHER_ARGS": "$(TargetPath)",
"ASPNETCORE_ENVIRONMENT": "Development",
"LAUNCHER_PATH": "$(DotNetPath)",
"ASPNETCORE_MODULE_DEBUG": "console"
}
}
}
}