From 293d165a8012c2bfda0930b3f28920f319bcd8c6 Mon Sep 17 00:00:00 2001 From: Pavel Krymets Date: Thu, 18 Oct 2018 12:37:13 -0700 Subject: [PATCH 01/12] Fix flaky disconnect test (#1533) --- .../Core/IISHttpContext.IO.cs | 12 ++++++++---- .../Core/IO/AsyncIOEngine.cs | 4 +++- test/IIS.Tests/ClientDisconnectTests.cs | 6 +----- test/IIS.Tests/TestServerTest.cs | 2 +- 4 files changed, 13 insertions(+), 11 deletions(-) diff --git a/src/Microsoft.AspNetCore.Server.IIS/Core/IISHttpContext.IO.cs b/src/Microsoft.AspNetCore.Server.IIS/Core/IISHttpContext.IO.cs index bfe44d634c..e945500672 100644 --- a/src/Microsoft.AspNetCore.Server.IIS/Core/IISHttpContext.IO.cs +++ b/src/Microsoft.AspNetCore.Server.IIS/Core/IISHttpContext.IO.cs @@ -184,11 +184,11 @@ namespace Microsoft.AspNetCore.Server.IIS.Core } } - private void AbortIO() + private bool AbortIO() { if (Interlocked.CompareExchange(ref _requestAborted, 1, 0) != 0) { - return; + return false; } _bodyOutput.Dispose(); @@ -208,6 +208,8 @@ namespace Microsoft.AspNetCore.Server.IIS.Core } }); } + + return true; } public void Abort(Exception reason) @@ -221,8 +223,10 @@ namespace Microsoft.AspNetCore.Server.IIS.Core internal void ConnectionReset() { - AbortIO(); - Log.ConnectionDisconnect(_logger, ((IHttpConnectionFeature)this).ConnectionId); + if (AbortIO()) + { + Log.ConnectionDisconnect(_logger, ((IHttpConnectionFeature)this).ConnectionId); + } } } } diff --git a/src/Microsoft.AspNetCore.Server.IIS/Core/IO/AsyncIOEngine.cs b/src/Microsoft.AspNetCore.Server.IIS/Core/IO/AsyncIOEngine.cs index e7a01b331d..f169cebf77 100644 --- a/src/Microsoft.AspNetCore.Server.IIS/Core/IO/AsyncIOEngine.cs +++ b/src/Microsoft.AspNetCore.Server.IIS/Core/IO/AsyncIOEngine.cs @@ -52,7 +52,9 @@ namespace Microsoft.AspNetCore.Server.IIS.Core.IO { if (_stopped) { - throw new IOException("IO stopped", NativeMethods.ERROR_OPERATION_ABORTED); + // Abort all operation after IO was stopped + ioOperation.Complete(NativeMethods.ERROR_OPERATION_ABORTED, 0); + return; } if (_runningOperation != null) diff --git a/test/IIS.Tests/ClientDisconnectTests.cs b/test/IIS.Tests/ClientDisconnectTests.cs index d8c7d4ef89..dbe562aa7c 100644 --- a/test/IIS.Tests/ClientDisconnectTests.cs +++ b/test/IIS.Tests/ClientDisconnectTests.cs @@ -2,13 +2,11 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; -using System.IO; using System.Threading; using System.Threading.Tasks; using Microsoft.AspNetCore.Connections; using Microsoft.AspNetCore.Server.IntegrationTesting; using Microsoft.AspNetCore.Testing.xunit; -using Microsoft.Extensions.Logging.Testing; using Xunit; namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests @@ -207,8 +205,6 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests } Assert.IsType(exception); } - - AssertConnectionDisconnectLog(); } [ConditionalFact] @@ -289,7 +285,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests private void AssertConnectionDisconnectLog() { - Assert.Contains(TestSink.Writes, w => w.EventId.Name == "ConnectionDisconnect"); + Assert.Single(TestSink.Writes, w => w.EventId.Name == "ConnectionDisconnect"); } private static async Task SendContentLength1Post(TestConnection connection) diff --git a/test/IIS.Tests/TestServerTest.cs b/test/IIS.Tests/TestServerTest.cs index c168af99d8..40b538ea52 100644 --- a/test/IIS.Tests/TestServerTest.cs +++ b/test/IIS.Tests/TestServerTest.cs @@ -11,7 +11,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests { [SkipIfHostableWebCoreNotAvailable] [OSSkipCondition(OperatingSystems.Windows, WindowsVersions.Win7, "https://github.com/aspnet/IISIntegration/issues/866")] - public class TestServerTest : LoggedTest + public class TestServerTest : StrictTestServerTests { [ConditionalFact] public async Task SingleProcessTestServer_HelloWorld() From b92c82e97f19f77c95752340066a64a337551e6d Mon Sep 17 00:00:00 2001 From: Justin Kotalik Date: Thu, 18 Oct 2018 13:58:56 -0700 Subject: [PATCH 02/12] Add static shim test (#1505) --- .appveyor.yml | 2 +- .vsts-pipelines/templates/build-steps.yml | 1 + IISIntegration.NoV1.sln | 17 +++++- IISIntegration.sln | 23 ++++++++ build/build.msbuild | 34 ----------- build/buildpipeline/pipeline.groovy | 2 + build/buildpipeline/windows-staticshim.groovy | 15 +++++ build/buildpipeline/windows.groovy | 2 +- build/dependencies.props | 5 +- build/functional-test-assets.targets | 10 ++++ build/repo.props | 12 ++++ build/testsite.props | 1 - ...tCore.Server.IntegrationTesting.IIS.csproj | 29 +++------- .../Inprocess/StartupTests.cs | 0 .../OutOfProcess/GlobalVersionTests.cs | 1 + .../BackwardsCompatibilityTests.cs | 49 ++++++++++++++++ ...kwardsCompatibility.FunctionalTests.csproj | 56 +++++++++++++++++++ .../RequiresNewShim.cs | 17 ++++++ .../IIS.FunctionalTests.csproj | 3 + test/IIS.FunctionalTests/RequiresNewShim.cs | 17 ++++++ .../DeployerSelector.cs | 0 .../Inprocess/StdOutRedirectionTests.cs | 0 .../MofFileTests.cs | 0 .../Properties/AssemblyInfo.cs | 0 .../RequiresIISAttribute.cs | 2 +- .../ServicesTests.cs | 0 test/IIS.Tests/IIS.Tests.csproj | 5 +- .../IISExpress.FunctionalTests.csproj | 2 + .../RequiresNewShim.cs | 17 ++++++ 29 files changed, 258 insertions(+), 64 deletions(-) delete mode 100644 build/build.msbuild create mode 100644 build/buildpipeline/windows-staticshim.groovy create mode 100644 build/functional-test-assets.targets rename test/{IIS.FunctionalTests => Common.FunctionalTests}/Inprocess/StartupTests.cs (100%) create mode 100644 test/IIS.BackwardsCompatibility.FunctionalTests/BackwardsCompatibilityTests.cs create mode 100644 test/IIS.BackwardsCompatibility.FunctionalTests/IIS.BackwardsCompatibility.FunctionalTests.csproj create mode 100644 test/IIS.BackwardsCompatibility.FunctionalTests/RequiresNewShim.cs create mode 100644 test/IIS.FunctionalTests/RequiresNewShim.cs rename test/{IIS.FunctionalTests => IIS.Shared.FunctionalTests}/DeployerSelector.cs (100%) rename test/{IIS.FunctionalTests => IIS.Shared.FunctionalTests}/Inprocess/StdOutRedirectionTests.cs (100%) rename test/{IIS.FunctionalTests => IIS.Shared.FunctionalTests}/MofFileTests.cs (100%) rename test/{IIS.FunctionalTests => IIS.Shared.FunctionalTests}/Properties/AssemblyInfo.cs (100%) rename test/{IIS.FunctionalTests => IIS.Shared.FunctionalTests}/RequiresIISAttribute.cs (99%) rename test/{IIS.FunctionalTests => IIS.Shared.FunctionalTests}/ServicesTests.cs (100%) create mode 100644 test/IISExpress.FunctionalTests/RequiresNewShim.cs diff --git a/.appveyor.yml b/.appveyor.yml index 2bc93c45a8..f67ca4c0d5 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -16,7 +16,7 @@ install: - git submodule update --init --recursive - net start w3svc build_script: - - ps: .\run.ps1 default-build + - ps: .\run.ps1 default-build /p:SkipIISBackwardsCompatibilityTests=true clone_depth: 1 environment: global: diff --git a/.vsts-pipelines/templates/build-steps.yml b/.vsts-pipelines/templates/build-steps.yml index 36219f533b..780a42a356 100644 --- a/.vsts-pipelines/templates/build-steps.yml +++ b/.vsts-pipelines/templates/build-steps.yml @@ -2,6 +2,7 @@ phases: - template: .vsts-pipelines/templates/phases/default-build.yml@buildtools parameters: agentOs: Windows + buildArgs: /p:SkipIISBackwardsCompatibilityTests=true beforeBuild: - powershell: "& ./tools/UpdateIISExpressCertificate.ps1; & ./tools/update_schema.ps1; & ./tools/SetupTestEnvironment.ps1 Setup" displayName: Prepare repo diff --git a/IISIntegration.NoV1.sln b/IISIntegration.NoV1.sln index cbe801fc32..2ee59d14bf 100644 --- a/IISIntegration.NoV1.sln +++ b/IISIntegration.NoV1.sln @@ -36,10 +36,10 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{7E80C58E ProjectSection(SolutionItems) = preProject build\applicationhost.config = build\applicationhost.config build\applicationhost.iis.config = build\applicationhost.iis.config - build\build.msbuild = build\build.msbuild build\Build.Settings = build\Build.Settings build\Config.Definitions.Props = build\Config.Definitions.Props build\dependencies.props = build\dependencies.props + build\functional-test-assets.targets = build\functional-test-assets.targets build\Key.snk = build\Key.snk build\launchSettings.json = build\launchSettings.json build\native.targets = build\native.targets @@ -113,6 +113,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IIS.Tests", "test\IIS.Tests EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Common.Tests", "test\Common.Tests\Common.Tests.csproj", "{D17B7B35-5361-4A50-B499-E03E5C3CC095}" EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IIS.BackwardsCompatibility.FunctionalTests", "test\IIS.BackwardsCompatibility.FunctionalTests\IIS.BackwardsCompatibility.FunctionalTests.csproj", "{582B07BC-73F4-4689-8557-B039298BD82C}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -383,6 +385,18 @@ Global {D17B7B35-5361-4A50-B499-E03E5C3CC095}.Release|x64.Build.0 = Release|Any CPU {D17B7B35-5361-4A50-B499-E03E5C3CC095}.Release|x86.ActiveCfg = Release|Any CPU {D17B7B35-5361-4A50-B499-E03E5C3CC095}.Release|x86.Build.0 = Release|Any CPU + {582B07BC-73F4-4689-8557-B039298BD82C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {582B07BC-73F4-4689-8557-B039298BD82C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {582B07BC-73F4-4689-8557-B039298BD82C}.Debug|x64.ActiveCfg = Debug|Any CPU + {582B07BC-73F4-4689-8557-B039298BD82C}.Debug|x64.Build.0 = Debug|Any CPU + {582B07BC-73F4-4689-8557-B039298BD82C}.Debug|x86.ActiveCfg = Debug|Any CPU + {582B07BC-73F4-4689-8557-B039298BD82C}.Debug|x86.Build.0 = Debug|Any CPU + {582B07BC-73F4-4689-8557-B039298BD82C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {582B07BC-73F4-4689-8557-B039298BD82C}.Release|Any CPU.Build.0 = Release|Any CPU + {582B07BC-73F4-4689-8557-B039298BD82C}.Release|x64.ActiveCfg = Release|Any CPU + {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 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -413,6 +427,7 @@ Global {34135ED7-313D-4E68-860C-D6B51AA28523} = {04B1EDB6-E967-4D25-89B9-E6F8304038CD} {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} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {DB4F868D-E1AE-4FD7-9333-69FA15B268C5} diff --git a/IISIntegration.sln b/IISIntegration.sln index 34a5050f7e..6e8b394d5a 100644 --- a/IISIntegration.sln +++ b/IISIntegration.sln @@ -121,6 +121,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IIS.Tests", "test\IIS.Tests EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Common.Tests", "test\Common.Tests\Common.Tests.csproj", "{A641A208-2974-4E48-BCFF-54E3AAFA4FB9}" EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IIS.BackwardsCompatibility.FunctionalTests", "test\IIS.BackwardsCompatibility.FunctionalTests\IIS.BackwardsCompatibility.FunctionalTests.csproj", "{28055B05-25D4-4F17-9F36-A1D09FDDA607}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -637,6 +639,26 @@ Global {A641A208-2974-4E48-BCFF-54E3AAFA4FB9}.Release|x64.Build.0 = Release|Any CPU {A641A208-2974-4E48-BCFF-54E3AAFA4FB9}.Release|x86.ActiveCfg = Release|Any CPU {A641A208-2974-4E48-BCFF-54E3AAFA4FB9}.Release|x86.Build.0 = Release|Any CPU + {28055B05-25D4-4F17-9F36-A1D09FDDA607}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {28055B05-25D4-4F17-9F36-A1D09FDDA607}.Debug|Any CPU.Build.0 = Debug|Any CPU + {28055B05-25D4-4F17-9F36-A1D09FDDA607}.Debug|x64.ActiveCfg = Debug|Any CPU + {28055B05-25D4-4F17-9F36-A1D09FDDA607}.Debug|x64.Build.0 = Debug|Any CPU + {28055B05-25D4-4F17-9F36-A1D09FDDA607}.Debug|x86.ActiveCfg = Debug|Any CPU + {28055B05-25D4-4F17-9F36-A1D09FDDA607}.Debug|x86.Build.0 = Debug|Any CPU + {28055B05-25D4-4F17-9F36-A1D09FDDA607}.NativeDebug|Any CPU.ActiveCfg = Debug|Any CPU + {28055B05-25D4-4F17-9F36-A1D09FDDA607}.NativeDebug|Any CPU.Build.0 = Debug|Any CPU + {28055B05-25D4-4F17-9F36-A1D09FDDA607}.NativeDebug|x64.ActiveCfg = Debug|Any CPU + {28055B05-25D4-4F17-9F36-A1D09FDDA607}.NativeDebug|x86.ActiveCfg = Debug|Any CPU + {28055B05-25D4-4F17-9F36-A1D09FDDA607}.NativeRelease|Any CPU.ActiveCfg = Release|Any CPU + {28055B05-25D4-4F17-9F36-A1D09FDDA607}.NativeRelease|Any CPU.Build.0 = Release|Any CPU + {28055B05-25D4-4F17-9F36-A1D09FDDA607}.NativeRelease|x64.ActiveCfg = Release|Any CPU + {28055B05-25D4-4F17-9F36-A1D09FDDA607}.NativeRelease|x86.ActiveCfg = Release|Any CPU + {28055B05-25D4-4F17-9F36-A1D09FDDA607}.Release|Any CPU.ActiveCfg = Release|Any CPU + {28055B05-25D4-4F17-9F36-A1D09FDDA607}.Release|Any CPU.Build.0 = Release|Any CPU + {28055B05-25D4-4F17-9F36-A1D09FDDA607}.Release|x64.ActiveCfg = Release|Any CPU + {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 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -670,6 +692,7 @@ Global {CE4FB142-91FB-4B34-BC96-A31120EF4009} = {04B1EDB6-E967-4D25-89B9-E6F8304038CD} {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} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {DB4F868D-E1AE-4FD7-9333-69FA15B268C5} diff --git a/build/build.msbuild b/build/build.msbuild deleted file mode 100644 index c97f1a53b5..0000000000 --- a/build/build.msbuild +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/build/buildpipeline/pipeline.groovy b/build/buildpipeline/pipeline.groovy index 7ccbca0b2a..7d4b4aef15 100644 --- a/build/buildpipeline/pipeline.groovy +++ b/build/buildpipeline/pipeline.groovy @@ -1,6 +1,7 @@ import org.dotnet.ci.pipelines.Pipeline def windowsPipeline = Pipeline.createPipeline(this, 'build/buildpipeline/windows.groovy') +def windowBackwardsCompatibilityPipeline = Pipeline.createPipeline(this, 'build/buildpipeline/windows-BackwardsCompatibility.groovy') def configurations = [ 'Debug', @@ -15,4 +16,5 @@ configurations.each { configuration -> windowsPipeline.triggerPipelineOnEveryGithubPR("Windows ${configuration} x64 Build", params) windowsPipeline.triggerPipelineOnGithubPush(params) + windowBackwardsCompatibilityPipeline.triggerPipelineOnEveryGithubPR("Windows ${configuration} x64 Build", params) } diff --git a/build/buildpipeline/windows-staticshim.groovy b/build/buildpipeline/windows-staticshim.groovy new file mode 100644 index 0000000000..b6b81e2f0b --- /dev/null +++ b/build/buildpipeline/windows-staticshim.groovy @@ -0,0 +1,15 @@ +@Library('dotnet-ci') _ + +// 'node' indicates to Jenkins that the enclosed block runs on a node that matches +// the label 'windows-with-vs' +simpleNode('Windows.10.Amd64.EnterpriseRS3.ASPNET.Open') { + stage ('Checking out source') { + checkout scm + bat 'git submodule update --init --recursive' + } + 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:SkipIISTests=true /p:SkipIISExpressTests=true /p:Configuration=${params.Configuration}\";" + } +} diff --git a/build/buildpipeline/windows.groovy b/build/buildpipeline/windows.groovy index 35bb4737ae..cc42e9ab4f 100644 --- a/build/buildpipeline/windows.groovy +++ b/build/buildpipeline/windows.groovy @@ -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: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:Configuration=${params.Configuration}\";" } } diff --git a/build/dependencies.props b/build/dependencies.props index 5c5ee5437f..5f13736d12 100644 --- a/build/dependencies.props +++ b/build/dependencies.props @@ -54,5 +54,8 @@ 2.4.0 - + + 2.2.0-preview3-35458 + 2.2.0-preview3-35458 + diff --git a/build/functional-test-assets.targets b/build/functional-test-assets.targets new file mode 100644 index 0000000000..81fb82b4a3 --- /dev/null +++ b/build/functional-test-assets.targets @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/build/repo.props b/build/repo.props index 77073056a2..fd4d80cb7a 100644 --- a/build/repo.props +++ b/build/repo.props @@ -13,6 +13,18 @@ + + + + + + + + + + + + Internal.AspNetCore.Universe.Lineup diff --git a/build/testsite.props b/build/testsite.props index 1ef6bf81cc..74f205b4cf 100644 --- a/build/testsite.props +++ b/build/testsite.props @@ -23,7 +23,6 @@ x64 - Internal.AspNetCore.Universe.Lineup diff --git a/test/Common.FunctionalTests/Inprocess/ErrorPagesTests.cs b/test/Common.FunctionalTests/Inprocess/ErrorPagesTests.cs index 936ad852ac..bf45949491 100644 --- a/test/Common.FunctionalTests/Inprocess/ErrorPagesTests.cs +++ b/test/Common.FunctionalTests/Inprocess/ErrorPagesTests.cs @@ -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); diff --git a/test/Common.FunctionalTests/Inprocess/StartupTests.cs b/test/Common.FunctionalTests/Inprocess/StartupTests.cs index 5ca1733443..3bcc134cb2 100644 --- a/test/Common.FunctionalTests/Inprocess/StartupTests.cs +++ b/test/Common.FunctionalTests/Inprocess/StartupTests.cs @@ -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] diff --git a/test/IIS.FunctionalTests/RequiresNewShim.cs b/test/Common.FunctionalTests/RequiresNewHandler.cs similarity index 57% rename from test/IIS.FunctionalTests/RequiresNewShim.cs rename to test/Common.FunctionalTests/RequiresNewHandler.cs index 1765ba2d1e..cbe43ec0c7 100644 --- a/test/IIS.FunctionalTests/RequiresNewShim.cs +++ b/test/Common.FunctionalTests/RequiresNewHandler.cs @@ -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."; } } diff --git a/test/IIS.BackwardsCompatibility.FunctionalTests/RequiresNewShim.cs b/test/Common.FunctionalTests/RequiresNewShim.cs similarity index 87% rename from test/IIS.BackwardsCompatibility.FunctionalTests/RequiresNewShim.cs rename to test/Common.FunctionalTests/RequiresNewShim.cs index f14085b05b..b0bc50a83b 100644 --- a/test/IIS.BackwardsCompatibility.FunctionalTests/RequiresNewShim.cs +++ b/test/Common.FunctionalTests/RequiresNewShim.cs @@ -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."; } diff --git a/test/Common.FunctionalTests/Utilities/Helpers.cs b/test/Common.FunctionalTests/Utilities/Helpers.cs index 733030dbc8..1e31126eab 100644 --- a/test/Common.FunctionalTests/Utilities/Helpers.cs +++ b/test/Common.FunctionalTests/Utilities/Helpers.cs @@ -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"); diff --git a/test/IIS.BackwardsCompatibility.FunctionalTests/BackwardsCompatibilityTests.cs b/test/IIS.BackwardsCompatibility.FunctionalTests/BackwardsCompatibilityTests.cs index a7243b0272..891c16c061 100644 --- a/test/IIS.BackwardsCompatibility.FunctionalTests/BackwardsCompatibilityTests.cs +++ b/test/IIS.BackwardsCompatibility.FunctionalTests/BackwardsCompatibilityTests.cs @@ -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}"); } } } diff --git a/test/IIS.BackwardsCompatibility.FunctionalTests/DeployerSelector.cs b/test/IIS.BackwardsCompatibility.FunctionalTests/DeployerSelector.cs index b6dc197e8a..5c6f3739a4 100644 --- a/test/IIS.BackwardsCompatibility.FunctionalTests/DeployerSelector.cs +++ b/test/IIS.BackwardsCompatibility.FunctionalTests/DeployerSelector.cs @@ -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; } } diff --git a/test/IIS.BackwardsCompatibility.FunctionalTests/IIS.BackwardsCompatibility.FunctionalTests.csproj b/test/IIS.BackwardsCompatibility.FunctionalTests/IIS.BackwardsCompatibility.FunctionalTests.csproj index 58708fa85f..d3e2bbc530 100644 --- a/test/IIS.BackwardsCompatibility.FunctionalTests/IIS.BackwardsCompatibility.FunctionalTests.csproj +++ b/test/IIS.BackwardsCompatibility.FunctionalTests/IIS.BackwardsCompatibility.FunctionalTests.csproj @@ -43,14 +43,4 @@ - - - - - - - PreserveNewest - - - diff --git a/test/IIS.ForwardsCompatibility.FunctionalTests/DeployerSelector.cs b/test/IIS.ForwardsCompatibility.FunctionalTests/DeployerSelector.cs new file mode 100644 index 0000000000..bd7aabbe0f --- /dev/null +++ b/test/IIS.ForwardsCompatibility.FunctionalTests/DeployerSelector.cs @@ -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; + } +} diff --git a/test/IIS.ForwardsCompatibility.FunctionalTests/ForwardsCompatibilityTests.cs b/test/IIS.ForwardsCompatibility.FunctionalTests/ForwardsCompatibilityTests.cs new file mode 100644 index 0000000000..52c7da80ad --- /dev/null +++ b/test/IIS.ForwardsCompatibility.FunctionalTests/ForwardsCompatibilityTests.cs @@ -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}"); + } + } +} diff --git a/test/IIS.ForwardsCompatibility.FunctionalTests/IIS.ForwardsCompatibility.FunctionalTests.csproj b/test/IIS.ForwardsCompatibility.FunctionalTests/IIS.ForwardsCompatibility.FunctionalTests.csproj new file mode 100644 index 0000000000..929f6ec6b0 --- /dev/null +++ b/test/IIS.ForwardsCompatibility.FunctionalTests/IIS.ForwardsCompatibility.FunctionalTests.csproj @@ -0,0 +1,45 @@ + + + + netcoreapp2.2 + IISForwardsCompatibility.FunctionalTests + True + + + + + + + + + + False + + + False + + + False + + + + + + + + + + + + + + + + + + + + + + + diff --git a/test/IIS.FunctionalTests/DeployerSelector.cs b/test/IIS.FunctionalTests/DeployerSelector.cs index 2359de7226..f2e1be321e 100644 --- a/test/IIS.FunctionalTests/DeployerSelector.cs +++ b/test/IIS.FunctionalTests/DeployerSelector.cs @@ -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; } } diff --git a/test/IIS.FunctionalTests/IIS.FunctionalTests.csproj b/test/IIS.FunctionalTests/IIS.FunctionalTests.csproj index 47c316f65a..62dec62e60 100644 --- a/test/IIS.FunctionalTests/IIS.FunctionalTests.csproj +++ b/test/IIS.FunctionalTests/IIS.FunctionalTests.csproj @@ -43,14 +43,4 @@ - - - - - - - PreserveNewest - - - diff --git a/test/IISExpress.FunctionalTests/DeployerSelector.cs b/test/IISExpress.FunctionalTests/DeployerSelector.cs index c21900e0fb..ba6a1ec6e2 100644 --- a/test/IISExpress.FunctionalTests/DeployerSelector.cs +++ b/test/IISExpress.FunctionalTests/DeployerSelector.cs @@ -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; } } diff --git a/test/IISExpress.FunctionalTests/IISExpress.FunctionalTests.csproj b/test/IISExpress.FunctionalTests/IISExpress.FunctionalTests.csproj index ff8fd55afb..988c2d5943 100644 --- a/test/IISExpress.FunctionalTests/IISExpress.FunctionalTests.csproj +++ b/test/IISExpress.FunctionalTests/IISExpress.FunctionalTests.csproj @@ -35,14 +35,4 @@ - - - - - - - PreserveNewest - - - diff --git a/test/IISExpress.FunctionalTests/RequiresNewShim.cs b/test/IISExpress.FunctionalTests/RequiresNewShim.cs deleted file mode 100644 index a43e9b8da7..0000000000 --- a/test/IISExpress.FunctionalTests/RequiresNewShim.cs +++ /dev/null @@ -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."; - } -} diff --git a/test/WebSites/InProcessForwardsCompatWebSite/InProcessWebSite.csproj b/test/WebSites/InProcessForwardsCompatWebSite/InProcessWebSite.csproj new file mode 100644 index 0000000000..f15a90bfd3 --- /dev/null +++ b/test/WebSites/InProcessForwardsCompatWebSite/InProcessWebSite.csproj @@ -0,0 +1,32 @@ + + + + + + netcoreapp2.2 + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/test/WebSites/InProcessForwardsCompatWebSite/Properties/launchSettings.json b/test/WebSites/InProcessForwardsCompatWebSite/Properties/launchSettings.json new file mode 100644 index 0000000000..246b7a0b47 --- /dev/null +++ b/test/WebSites/InProcessForwardsCompatWebSite/Properties/launchSettings.json @@ -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" + } + } + } +}