From 35746adf68798336bbb6d0f709b66a394c2734e9 Mon Sep 17 00:00:00 2001 From: Pavel Krymets <pavel@krymets.com> Date: Fri, 1 Feb 2019 15:19:49 -0800 Subject: [PATCH] Allow test projects to run standalone (#7144) --- .../src/Deployers/ApplicationDeployer.cs | 27 ++++++----- .../Common.FunctionalTests/AppOfflineTests.cs | 4 +- .../Common.FunctionalTests/BasicAuthTests.cs | 2 +- .../CommonStartupTests.cs | 2 +- .../ConfigurationChangeTests.cs | 8 ++-- .../test/Common.FunctionalTests/HttpsTests.cs | 6 +-- .../Inprocess/EnvironmentVariableTests.cs | 12 ++--- .../Inprocess/ErrorPagesTests.cs | 8 ++-- .../Inprocess/EventLogTests.cs | 4 +- .../Inprocess/FrebTests.cs | 4 +- .../Inprocess/HelloWorldTests.cs | 4 +- .../Inprocess/LogPipeTests.cs | 6 +-- .../Inprocess/ShutdownTests.cs | 4 +- .../Inprocess/StartupExceptionTests.cs | 8 ++-- .../Inprocess/StartupTests.cs | 44 ++++++++--------- .../Common.FunctionalTests/LogFileTests.cs | 18 +++---- .../MultiApplicationTests.cs | 6 +-- .../OutOfProcess/AspNetCorePortTests.cs | 6 +-- .../OutOfProcess/GlobalVersionTests.cs | 2 +- .../PublishedApplicationPublisher.cs | 47 ++++++++++++++----- .../PublishedSitesFixture.cs | 28 ++++++----- .../Utilities/Helpers.cs | 11 ++--- .../Utilities/IISTestSiteFixture.cs | 18 +++---- .../Inprocess/StdOutRedirectionTests.cs | 10 ++-- .../ServicesTests.cs | 4 +- .../IISExpress.FunctionalTests.csproj | 2 +- .../InProcess/AuthenticationTests.cs | 2 +- .../InProcess/IISExpressShutdownTests.cs | 8 ++-- .../UpgradeFeatureDetectionTests.cs | 8 +--- .../InProcessWebSite.csproj | 1 + .../src/IISDeploymentParameters.cs | 8 ++-- .../src/IISExpressDeployer.cs | 35 +++++++------- src/Servers/IIS/build/testsite.props | 38 +++++++++------ 33 files changed, 213 insertions(+), 182 deletions(-) diff --git a/src/Hosting/Server.IntegrationTesting/src/Deployers/ApplicationDeployer.cs b/src/Hosting/Server.IntegrationTesting/src/Deployers/ApplicationDeployer.cs index 5e1457e70fe..c6464a9833b 100644 --- a/src/Hosting/Server.IntegrationTesting/src/Deployers/ApplicationDeployer.cs +++ b/src/Hosting/Server.IntegrationTesting/src/Deployers/ApplicationDeployer.cs @@ -1,4 +1,4 @@ -// 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; @@ -45,19 +45,22 @@ namespace Microsoft.AspNetCore.Server.IntegrationTesting DeploymentParameters.RuntimeFlavor = GetRuntimeFlavor(DeploymentParameters.TargetFramework); } - if (string.IsNullOrEmpty(DeploymentParameters.ApplicationPath)) + if (DeploymentParameters.ApplicationPublisher == null) { - throw new ArgumentException("ApplicationPath cannot be null."); - } + if (string.IsNullOrEmpty(DeploymentParameters.ApplicationPath)) + { + throw new ArgumentException("ApplicationPath cannot be null."); + } - if (!Directory.Exists(DeploymentParameters.ApplicationPath)) - { - throw new DirectoryNotFoundException(string.Format("Application path {0} does not exist.", DeploymentParameters.ApplicationPath)); - } + if (!Directory.Exists(DeploymentParameters.ApplicationPath)) + { + throw new DirectoryNotFoundException(string.Format("Application path {0} does not exist.", DeploymentParameters.ApplicationPath)); + } - if (string.IsNullOrEmpty(DeploymentParameters.ApplicationName)) - { - DeploymentParameters.ApplicationName = new DirectoryInfo(DeploymentParameters.ApplicationPath).Name; + if (string.IsNullOrEmpty(DeploymentParameters.ApplicationName)) + { + DeploymentParameters.ApplicationName = new DirectoryInfo(DeploymentParameters.ApplicationPath).Name; + } } } @@ -97,7 +100,7 @@ namespace Microsoft.AspNetCore.Server.IntegrationTesting } else { - _publishedApplication.Dispose(); + _publishedApplication?.Dispose(); } } } diff --git a/src/Servers/IIS/IIS/test/Common.FunctionalTests/AppOfflineTests.cs b/src/Servers/IIS/IIS/test/Common.FunctionalTests/AppOfflineTests.cs index 7d8d661ef04..4c40a1f790f 100644 --- a/src/Servers/IIS/IIS/test/Common.FunctionalTests/AppOfflineTests.cs +++ b/src/Servers/IIS/IIS/test/Common.FunctionalTests/AppOfflineTests.cs @@ -66,7 +66,7 @@ namespace Microsoft.AspNetCore.Server.IIS.FunctionalTests [InlineData(HostingModel.OutOfProcess, 502, "502.5")] public async Task AppOfflineDroppedWhileSiteFailedToStartInShim_AppOfflineServed(HostingModel hostingModel, int statusCode, string content) { - var deploymentParameters = _fixture.GetBaseDeploymentParameters(hostingModel: hostingModel, publish: true); + var deploymentParameters = _fixture.GetBaseDeploymentParameters(hostingModel: hostingModel); deploymentParameters.WebConfigActionList.Add(WebConfigHelpers.AddOrModifyAspNetCoreSection("processPath", "nonexistent")); var deploymentResult = await DeployAsync(deploymentParameters); @@ -228,7 +228,7 @@ namespace Microsoft.AspNetCore.Server.IIS.FunctionalTests private async Task<IISDeploymentResult> DeployApp(HostingModel hostingModel = HostingModel.InProcess) { - var deploymentParameters = _fixture.GetBaseDeploymentParameters(hostingModel: hostingModel, publish: true); + var deploymentParameters = _fixture.GetBaseDeploymentParameters(hostingModel: hostingModel); return await DeployAsync(deploymentParameters); } diff --git a/src/Servers/IIS/IIS/test/Common.FunctionalTests/BasicAuthTests.cs b/src/Servers/IIS/IIS/test/Common.FunctionalTests/BasicAuthTests.cs index 9f9789b8a2f..46ef274648f 100644 --- a/src/Servers/IIS/IIS/test/Common.FunctionalTests/BasicAuthTests.cs +++ b/src/Servers/IIS/IIS/test/Common.FunctionalTests/BasicAuthTests.cs @@ -40,7 +40,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests var username = Environment.GetEnvironmentVariable("ASPNETCORE_MODULE_TEST_USER"); var password = Environment.GetEnvironmentVariable("ASPNETCORE_MODULE_TEST_PASSWORD"); - var deploymentParameters = _fixture.GetBaseDeploymentParameters(variant, publish: true); + var deploymentParameters = _fixture.GetBaseDeploymentParameters(variant); deploymentParameters.SetAnonymousAuth(enabled: false); deploymentParameters.SetWindowsAuth(enabled: false); deploymentParameters.SetBasicAuth(enabled: true); diff --git a/src/Servers/IIS/IIS/test/Common.FunctionalTests/CommonStartupTests.cs b/src/Servers/IIS/IIS/test/Common.FunctionalTests/CommonStartupTests.cs index 60068649bef..3d5e52e5290 100644 --- a/src/Servers/IIS/IIS/test/Common.FunctionalTests/CommonStartupTests.cs +++ b/src/Servers/IIS/IIS/test/Common.FunctionalTests/CommonStartupTests.cs @@ -31,7 +31,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests [MemberData(nameof(TestVariants))] public async Task StartupStress(TestVariant variant) { - var deploymentParameters = _fixture.GetBaseDeploymentParameters(variant, publish: true); + var deploymentParameters = _fixture.GetBaseDeploymentParameters(variant); var deploymentResult = await DeployAsync(deploymentParameters); diff --git a/src/Servers/IIS/IIS/test/Common.FunctionalTests/ConfigurationChangeTests.cs b/src/Servers/IIS/IIS/test/Common.FunctionalTests/ConfigurationChangeTests.cs index 815ccc4eb24..3076e07cb9a 100644 --- a/src/Servers/IIS/IIS/test/Common.FunctionalTests/ConfigurationChangeTests.cs +++ b/src/Servers/IIS/IIS/test/Common.FunctionalTests/ConfigurationChangeTests.cs @@ -31,7 +31,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests [ConditionalFact] public async Task ConfigurationChangeStopsInProcess() { - var deploymentParameters = _fixture.GetBaseDeploymentParameters(HostingModel.InProcess, publish: true); + var deploymentParameters = _fixture.GetBaseDeploymentParameters(HostingModel.InProcess); var deploymentResult = await DeployAsync(deploymentParameters); @@ -46,7 +46,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests [ConditionalFact] public async Task ConfigurationChangeForcesChildProcessRestart() { - var deploymentParameters = _fixture.GetBaseDeploymentParameters(HostingModel.OutOfProcess, publish: true); + var deploymentParameters = _fixture.GetBaseDeploymentParameters(HostingModel.OutOfProcess); var deploymentResult = await DeployAsync(deploymentParameters); @@ -63,7 +63,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests [ConditionalFact] public async Task OutOfProcessToInProcessHostingModelSwitchWorks() { - var deploymentParameters = _fixture.GetBaseDeploymentParameters(HostingModel.OutOfProcess, publish: true); + var deploymentParameters = _fixture.GetBaseDeploymentParameters(HostingModel.OutOfProcess); var deploymentResult = await DeployAsync(deploymentParameters); @@ -88,7 +88,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests [InlineData(HostingModel.OutOfProcess)] public async Task ConfigurationTouchedStress(HostingModel hostingModel) { - var deploymentResult = await DeployAsync(_fixture.GetBaseDeploymentParameters(hostingModel, publish: true)); + var deploymentResult = await DeployAsync(_fixture.GetBaseDeploymentParameters(hostingModel)); await deploymentResult.AssertStarts(); var load = Helpers.StressLoad(deploymentResult.HttpClient, "/HelloWorld", response => { diff --git a/src/Servers/IIS/IIS/test/Common.FunctionalTests/HttpsTests.cs b/src/Servers/IIS/IIS/test/Common.FunctionalTests/HttpsTests.cs index 6c20cc5b283..a35cb60c351 100644 --- a/src/Servers/IIS/IIS/test/Common.FunctionalTests/HttpsTests.cs +++ b/src/Servers/IIS/IIS/test/Common.FunctionalTests/HttpsTests.cs @@ -80,7 +80,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests var appName = "\u041C\u043E\u0451\u041F\u0440\u0438\u043B\u043E\u0436\u0435\u043D\u0438\u0435"; var port = TestPortHelper.GetNextSSLPort(); - var deploymentParameters = _fixture.GetBaseDeploymentParameters(HostingModel.InProcess, publish: true); + var deploymentParameters = _fixture.GetBaseDeploymentParameters(HostingModel.InProcess); deploymentParameters.ApplicationBaseUriHint = $"https://localhost:{port}/"; deploymentParameters.AddHttpsToServerConfig(); deploymentParameters.AddServerConfigAction( @@ -100,7 +100,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests [RequiresNewShim] public async Task HttpsPortCanBeOverriden() { - var deploymentParameters = _fixture.GetBaseDeploymentParameters(HostingModel.OutOfProcess, publish: true); + var deploymentParameters = _fixture.GetBaseDeploymentParameters(HostingModel.OutOfProcess); deploymentParameters.AddServerConfigAction( element => { @@ -126,7 +126,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests var sslPort = GetNextSSLPort(); var anotherSslPort = GetNextSSLPort(sslPort); - var deploymentParameters = _fixture.GetBaseDeploymentParameters(HostingModel.OutOfProcess, publish: true); + var deploymentParameters = _fixture.GetBaseDeploymentParameters(HostingModel.OutOfProcess); deploymentParameters.AddServerConfigAction( element => { diff --git a/src/Servers/IIS/IIS/test/Common.FunctionalTests/Inprocess/EnvironmentVariableTests.cs b/src/Servers/IIS/IIS/test/Common.FunctionalTests/Inprocess/EnvironmentVariableTests.cs index d044e49c915..153f271d2e8 100644 --- a/src/Servers/IIS/IIS/test/Common.FunctionalTests/Inprocess/EnvironmentVariableTests.cs +++ b/src/Servers/IIS/IIS/test/Common.FunctionalTests/Inprocess/EnvironmentVariableTests.cs @@ -33,7 +33,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests "AReallyLongValueThatIsGreaterThan300CharactersToForceResizeInNative"; - var deploymentParameters = _fixture.GetBaseDeploymentParameters(hostingModel, publish: true); + var deploymentParameters = _fixture.GetBaseDeploymentParameters(hostingModel); deploymentParameters.WebConfigBasedEnvironmentVariables["ASPNETCORE_INPROCESS_TESTING_LONG_VALUE"] = expectedValue; Assert.Equal( @@ -50,7 +50,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests private async Task AuthHeaderEnvironmentVariableRemoved(HostingModel hostingModel) { - var deploymentParameters = _fixture.GetBaseDeploymentParameters(hostingModel, publish: true); + var deploymentParameters = _fixture.GetBaseDeploymentParameters(hostingModel); deploymentParameters.WebConfigBasedEnvironmentVariables["ASPNETCORE_IIS_HTTPAUTH"] = "shouldberemoved"; Assert.DoesNotContain("shouldberemoved", await GetStringAsync(deploymentParameters,"/GetEnvironmentVariable?name=ASPNETCORE_IIS_HTTPAUTH")); @@ -67,7 +67,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests private async Task WebConfigOverridesGlobalEnvironmentVariables(HostingModel hostingModel) { - var deploymentParameters = _fixture.GetBaseDeploymentParameters(hostingModel, publish: true); + var deploymentParameters = _fixture.GetBaseDeploymentParameters(hostingModel); deploymentParameters.EnvironmentVariables["ASPNETCORE_ENVIRONMENT"] = "Development"; deploymentParameters.WebConfigBasedEnvironmentVariables["ASPNETCORE_ENVIRONMENT"] = "Production"; Assert.Equal("Production", await GetStringAsync(deploymentParameters, "/GetEnvironmentVariable?name=ASPNETCORE_ENVIRONMENT")); @@ -84,7 +84,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests private async Task WebConfigAppendsHostingStartup(HostingModel hostingModel) { - var deploymentParameters = _fixture.GetBaseDeploymentParameters(hostingModel, publish: true); + var deploymentParameters = _fixture.GetBaseDeploymentParameters(hostingModel); deploymentParameters.EnvironmentVariables["ASPNETCORE_HOSTINGSTARTUPASSEMBLIES"] = "Asm1"; if (hostingModel == HostingModel.InProcess) { @@ -107,7 +107,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests private async Task WebConfigOverridesHostingStartup(HostingModel hostingModel) { - var deploymentParameters = _fixture.GetBaseDeploymentParameters(hostingModel, publish: true); + var deploymentParameters = _fixture.GetBaseDeploymentParameters(hostingModel); deploymentParameters.EnvironmentVariables["ASPNETCORE_HOSTINGSTARTUPASSEMBLIES"] = "Asm1"; deploymentParameters.WebConfigBasedEnvironmentVariables["ASPNETCORE_HOSTINGSTARTUPASSEMBLIES"] = "Asm2"; Assert.Equal("Asm2", await GetStringAsync(deploymentParameters, "/GetEnvironmentVariable?name=ASPNETCORE_HOSTINGSTARTUPASSEMBLIES")); @@ -124,7 +124,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests private async Task WebConfigExpandsVariables(HostingModel hostingModel) { - var deploymentParameters = _fixture.GetBaseDeploymentParameters(hostingModel, publish: true); + var deploymentParameters = _fixture.GetBaseDeploymentParameters(hostingModel); deploymentParameters.EnvironmentVariables["TestVariable"] = "World"; deploymentParameters.WebConfigBasedEnvironmentVariables["OtherVariable"] = "%TestVariable%;Hello"; Assert.Equal("World;Hello", await GetStringAsync(deploymentParameters, "/GetEnvironmentVariable?name=OtherVariable")); diff --git a/src/Servers/IIS/IIS/test/Common.FunctionalTests/Inprocess/ErrorPagesTests.cs b/src/Servers/IIS/IIS/test/Common.FunctionalTests/Inprocess/ErrorPagesTests.cs index f53571001e5..ca93fb2c93f 100644 --- a/src/Servers/IIS/IIS/test/Common.FunctionalTests/Inprocess/ErrorPagesTests.cs +++ b/src/Servers/IIS/IIS/test/Common.FunctionalTests/Inprocess/ErrorPagesTests.cs @@ -26,7 +26,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests [RequiresIIS(IISCapability.PoolEnvironmentVariables)] public async Task IncludesAdditionalErrorPageTextInProcessHandlerLoadFailure_CorrectString() { - var deploymentParameters = _fixture.GetBaseDeploymentParameters(publish: true); + var deploymentParameters = _fixture.GetBaseDeploymentParameters(); var response = await DeployAppWithStartupFailure(deploymentParameters); Assert.Equal(HttpStatusCode.InternalServerError, response.StatusCode); @@ -44,7 +44,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests [RequiresIIS(IISCapability.PoolEnvironmentVariables)] public async Task IncludesAdditionalErrorPageTextOutOfProcessStartupFailure_CorrectString() { - var deploymentParameters = _fixture.GetBaseDeploymentParameters(HostingModel.OutOfProcess, publish: true); + var deploymentParameters = _fixture.GetBaseDeploymentParameters(HostingModel.OutOfProcess); var response = await DeployAppWithStartupFailure(deploymentParameters); Assert.Equal(HttpStatusCode.BadGateway, response.StatusCode); @@ -62,7 +62,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests [RequiresIIS(IISCapability.PoolEnvironmentVariables)] public async Task IncludesAdditionalErrorPageTextOutOfProcessHandlerLoadFailure_CorrectString() { - var deploymentParameters = _fixture.GetBaseDeploymentParameters(HostingModel.OutOfProcess, publish: true); + var deploymentParameters = _fixture.GetBaseDeploymentParameters(HostingModel.OutOfProcess); deploymentParameters.HandlerSettings["handlerVersion"] = "88.93"; deploymentParameters.EnvironmentVariables["ANCM_ADDITIONAL_ERROR_PAGE_LINK"] = "http://example"; @@ -85,7 +85,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests [RequiresNewHandler] public async Task IncludesAdditionalErrorPageTextInProcessStartupFailure_CorrectString() { - var deploymentParameters = _fixture.GetBaseDeploymentParameters(publish: true); + var deploymentParameters = _fixture.GetBaseDeploymentParameters(); deploymentParameters.TransformArguments((a, _) => $"{a} EarlyReturn"); deploymentParameters.EnvironmentVariables["ANCM_ADDITIONAL_ERROR_PAGE_LINK"] = "http://example"; diff --git a/src/Servers/IIS/IIS/test/Common.FunctionalTests/Inprocess/EventLogTests.cs b/src/Servers/IIS/IIS/test/Common.FunctionalTests/Inprocess/EventLogTests.cs index 6f11ca5adad..194a1fca839 100644 --- a/src/Servers/IIS/IIS/test/Common.FunctionalTests/Inprocess/EventLogTests.cs +++ b/src/Servers/IIS/IIS/test/Common.FunctionalTests/Inprocess/EventLogTests.cs @@ -21,7 +21,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests [ConditionalFact] public async Task CheckStartupEventLogMessage() { - var deploymentParameters = _fixture.GetBaseDeploymentParameters(publish: true); + var deploymentParameters = _fixture.GetBaseDeploymentParameters(); var deploymentResult = await DeployAsync(deploymentParameters); await deploymentResult.AssertStarts(); @@ -34,7 +34,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests [ConditionalFact] public async Task CheckShutdownEventLogMessage() { - var deploymentParameters = _fixture.GetBaseDeploymentParameters(publish: true); + var deploymentParameters = _fixture.GetBaseDeploymentParameters(); var deploymentResult = await DeployAsync(deploymentParameters); await deploymentResult.AssertStarts(); diff --git a/src/Servers/IIS/IIS/test/Common.FunctionalTests/Inprocess/FrebTests.cs b/src/Servers/IIS/IIS/test/Common.FunctionalTests/Inprocess/FrebTests.cs index 12e2f6ae53c..5557908acd8 100644 --- a/src/Servers/IIS/IIS/test/Common.FunctionalTests/Inprocess/FrebTests.cs +++ b/src/Servers/IIS/IIS/test/Common.FunctionalTests/Inprocess/FrebTests.cs @@ -54,7 +54,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests [RequiresIIS(IISCapability.FailedRequestTracingModule)] public async Task FrebIncludesHResultFailures() { - var parameters = _fixture.GetBaseDeploymentParameters(publish: true); + var parameters = _fixture.GetBaseDeploymentParameters(); parameters.TransformArguments((args, _) => string.Empty); var result = await SetupFrebApp(parameters); @@ -104,7 +104,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests private async Task<IISDeploymentResult> SetupFrebApp(IISDeploymentParameters parameters = null) { - parameters = parameters ?? _fixture.GetBaseDeploymentParameters(publish: true); + parameters = parameters ?? _fixture.GetBaseDeploymentParameters(); parameters.EnableFreb("Verbose", _logFolderPath); Directory.CreateDirectory(_logFolderPath); diff --git a/src/Servers/IIS/IIS/test/Common.FunctionalTests/Inprocess/HelloWorldTests.cs b/src/Servers/IIS/IIS/test/Common.FunctionalTests/Inprocess/HelloWorldTests.cs index 1b2ad706001..04dc8bd3935 100644 --- a/src/Servers/IIS/IIS/test/Common.FunctionalTests/Inprocess/HelloWorldTests.cs +++ b/src/Servers/IIS/IIS/test/Common.FunctionalTests/Inprocess/HelloWorldTests.cs @@ -8,11 +8,11 @@ using Xunit; namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests { [Collection(IISTestSiteCollection.Name)] - public class HelloWorldInProcessTests + public class HelloWorldInProcessTests: FixtureLoggedTest { private readonly IISTestSiteFixture _fixture; - public HelloWorldInProcessTests(IISTestSiteFixture fixture) + public HelloWorldInProcessTests(IISTestSiteFixture fixture) : base(fixture) { _fixture = fixture; } diff --git a/src/Servers/IIS/IIS/test/Common.FunctionalTests/Inprocess/LogPipeTests.cs b/src/Servers/IIS/IIS/test/Common.FunctionalTests/Inprocess/LogPipeTests.cs index 4d34c3154f7..ff52881d525 100644 --- a/src/Servers/IIS/IIS/test/Common.FunctionalTests/Inprocess/LogPipeTests.cs +++ b/src/Servers/IIS/IIS/test/Common.FunctionalTests/Inprocess/LogPipeTests.cs @@ -26,7 +26,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests [InlineData("ConsoleWrite")] public async Task CheckStdoutLoggingToPipe_DoesNotCrashProcess(string path) { - var deploymentParameters = _fixture.GetBaseDeploymentParameters(publish: true); + var deploymentParameters = _fixture.GetBaseDeploymentParameters(); var deploymentResult = await DeployAsync(deploymentParameters); await Helpers.AssertStarts(deploymentResult, path); @@ -44,7 +44,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests [InlineData("ConsoleWriteStartServer")] public async Task CheckStdoutLoggingToPipeWithFirstWrite(string path) { - var deploymentParameters = _fixture.GetBaseDeploymentParameters(publish: true); + var deploymentParameters = _fixture.GetBaseDeploymentParameters(); var firstWriteString = "TEST MESSAGE"; @@ -67,7 +67,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests public async Task CheckUnicodePipe() { var path = "CheckConsoleFunctions"; - var deploymentParameters = _fixture.GetBaseDeploymentParameters(_fixture.InProcessTestSite, publish: true); + var deploymentParameters = _fixture.GetBaseDeploymentParameters(_fixture.InProcessTestSite); deploymentParameters.TransformArguments((a, _) => $"{a} {path}"); var deploymentResult = await DeployAsync(deploymentParameters); diff --git a/src/Servers/IIS/IIS/test/Common.FunctionalTests/Inprocess/ShutdownTests.cs b/src/Servers/IIS/IIS/test/Common.FunctionalTests/Inprocess/ShutdownTests.cs index b30a262b003..5515b5ef683 100644 --- a/src/Servers/IIS/IIS/test/Common.FunctionalTests/Inprocess/ShutdownTests.cs +++ b/src/Servers/IIS/IIS/test/Common.FunctionalTests/Inprocess/ShutdownTests.cs @@ -24,7 +24,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests [ConditionalFact] public async Task ShutdownTimeoutIsApplied() { - var deploymentParameters = _fixture.GetBaseDeploymentParameters(_fixture.InProcessTestSite, publish: true); + var deploymentParameters = _fixture.GetBaseDeploymentParameters(_fixture.InProcessTestSite); deploymentParameters.TransformArguments((a, _) => $"{a} HangOnStop"); deploymentParameters.WebConfigActionList.Add( WebConfigHelpers.AddOrModifyAspNetCoreSection("shutdownTimeLimit", "1")); @@ -47,7 +47,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests { // Canceled token doesn't affect shutdown, in-proc doesn't handle ungraceful shutdown // IIS's ShutdownTimeLimit will handle that. - var parameters = _fixture.GetBaseDeploymentParameters(publish: true); + var parameters = _fixture.GetBaseDeploymentParameters(); var deploymentResult = await DeployAsync(parameters); try { diff --git a/src/Servers/IIS/IIS/test/Common.FunctionalTests/Inprocess/StartupExceptionTests.cs b/src/Servers/IIS/IIS/test/Common.FunctionalTests/Inprocess/StartupExceptionTests.cs index cadfed97819..a5eaf1bda05 100644 --- a/src/Servers/IIS/IIS/test/Common.FunctionalTests/Inprocess/StartupExceptionTests.cs +++ b/src/Servers/IIS/IIS/test/Common.FunctionalTests/Inprocess/StartupExceptionTests.cs @@ -27,7 +27,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests [InlineData("CheckOversizedStdOutWrites")] public async Task CheckStdoutWithLargeWrites_TestSink(string mode) { - var deploymentParameters = _fixture.GetBaseDeploymentParameters(_fixture.InProcessTestSite, publish: true); + var deploymentParameters = _fixture.GetBaseDeploymentParameters(_fixture.InProcessTestSite); deploymentParameters.TransformArguments((a, _) => $"{a} {mode}"); var deploymentResult = await DeployAsync(deploymentParameters); @@ -44,7 +44,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests [InlineData("CheckOversizedStdOutWrites")] public async Task CheckStdoutWithLargeWrites_LogFile(string mode) { - var deploymentParameters = _fixture.GetBaseDeploymentParameters(_fixture.InProcessTestSite, publish: true); + var deploymentParameters = _fixture.GetBaseDeploymentParameters(_fixture.InProcessTestSite); deploymentParameters.TransformArguments((a, _) => $"{a} {mode}"); deploymentParameters.EnableLogging(_logFolderPath); @@ -62,7 +62,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests [ConditionalFact] public async Task CheckValidConsoleFunctions() { - var deploymentParameters = _fixture.GetBaseDeploymentParameters(_fixture.InProcessTestSite, publish: true); + var deploymentParameters = _fixture.GetBaseDeploymentParameters(_fixture.InProcessTestSite); deploymentParameters.TransformArguments((a, _) => $"{a} CheckConsoleFunctions"); var deploymentResult = await DeployAsync(deploymentParameters); @@ -84,7 +84,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests [ConditionalFact] public async Task Gets500_30_ErrorPage() { - var deploymentParameters = _fixture.GetBaseDeploymentParameters(_fixture.InProcessTestSite, publish: true); + var deploymentParameters = _fixture.GetBaseDeploymentParameters(_fixture.InProcessTestSite); deploymentParameters.TransformArguments((a, _) => $"{a} EarlyReturn"); var deploymentResult = await DeployAsync(deploymentParameters); diff --git a/src/Servers/IIS/IIS/test/Common.FunctionalTests/Inprocess/StartupTests.cs b/src/Servers/IIS/IIS/test/Common.FunctionalTests/Inprocess/StartupTests.cs index d4916fdcf93..5a8dadaf174 100644 --- a/src/Servers/IIS/IIS/test/Common.FunctionalTests/Inprocess/StartupTests.cs +++ b/src/Servers/IIS/IIS/test/Common.FunctionalTests/Inprocess/StartupTests.cs @@ -35,7 +35,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests public async Task ExpandEnvironmentVariableInWebConfig() { // Point to dotnet installed in user profile. - var deploymentParameters = _fixture.GetBaseDeploymentParameters(publish: true); + var deploymentParameters = _fixture.GetBaseDeploymentParameters(); deploymentParameters.EnvironmentVariables["DotnetPath"] = _dotnetLocation; deploymentParameters.WebConfigActionList.Add(WebConfigHelpers.AddOrModifyAspNetCoreSection("processPath", "%DotnetPath%")); await StartAsync(deploymentParameters); @@ -49,7 +49,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests [InlineData("dotnet.zip", "", @"Process path 'dotnet.zip' doesn't have '.exe' extension.")] public async Task InvalidProcessPath_ExpectServerError(string path, string arguments, string subError) { - var deploymentParameters = _fixture.GetBaseDeploymentParameters(publish: true); + var deploymentParameters = _fixture.GetBaseDeploymentParameters(); deploymentParameters.WebConfigActionList.Add(WebConfigHelpers.AddOrModifyAspNetCoreSection("processPath", path)); deploymentParameters.WebConfigActionList.Add(WebConfigHelpers.AddOrModifyAspNetCoreSection("arguments", arguments)); @@ -69,7 +69,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests [ConditionalFact] public async Task StartsWithDotnetLocationWithoutExe() { - var deploymentParameters = _fixture.GetBaseDeploymentParameters(publish: true); + var deploymentParameters = _fixture.GetBaseDeploymentParameters(); var dotnetLocationWithoutExtension = _dotnetLocation.Substring(0, _dotnetLocation.LastIndexOf(".")); deploymentParameters.WebConfigActionList.Add(WebConfigHelpers.AddOrModifyAspNetCoreSection("processPath", dotnetLocationWithoutExtension)); @@ -80,7 +80,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests [ConditionalFact] public async Task StartsWithDotnetLocationUppercase() { - var deploymentParameters = _fixture.GetBaseDeploymentParameters(publish: true); + var deploymentParameters = _fixture.GetBaseDeploymentParameters(); var dotnetLocationWithoutExtension = _dotnetLocation.Substring(0, _dotnetLocation.LastIndexOf(".")).ToUpperInvariant(); deploymentParameters.WebConfigActionList.Add(WebConfigHelpers.AddOrModifyAspNetCoreSection("processPath", dotnetLocationWithoutExtension)); @@ -94,7 +94,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests [RequiresIIS(IISCapability.PoolEnvironmentVariables)] public async Task StartsWithDotnetOnThePath(string path) { - var deploymentParameters = _fixture.GetBaseDeploymentParameters(publish: true); + var deploymentParameters = _fixture.GetBaseDeploymentParameters(); deploymentParameters.EnvironmentVariables["PATH"] = Path.GetDirectoryName(_dotnetLocation); deploymentParameters.WebConfigActionList.Add(WebConfigHelpers.AddOrModifyAspNetCoreSection("processPath", path)); @@ -115,7 +115,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests [RequiresIIS(IISCapability.PoolEnvironmentVariables)] public async Task StartsWithDotnetInstallLocation(RuntimeArchitecture runtimeArchitecture) { - var deploymentParameters = _fixture.GetBaseDeploymentParameters(publish: true); + var deploymentParameters = _fixture.GetBaseDeploymentParameters(); deploymentParameters.RuntimeArchitecture = runtimeArchitecture; // IIS doesn't allow empty PATH @@ -147,7 +147,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests [RequiresIIS(IISCapability.PoolEnvironmentVariables)] public async Task DoesNotStartIfDisabled() { - var deploymentParameters = _fixture.GetBaseDeploymentParameters(publish: true); + var deploymentParameters = _fixture.GetBaseDeploymentParameters(); using (new TestRegistryKey( Registry.LocalMachine, @@ -179,7 +179,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests [MemberData(nameof(TestVariants))] public async Task HelloWorld(TestVariant variant) { - var deploymentParameters = _fixture.GetBaseDeploymentParameters(variant, publish: true); + var deploymentParameters = _fixture.GetBaseDeploymentParameters(variant); await StartAsync(deploymentParameters); } @@ -187,7 +187,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests [RequiresIIS(IISCapability.PoolEnvironmentVariables)] public async Task StartsWithPortableAndBootstraperExe() { - var deploymentParameters = _fixture.GetBaseDeploymentParameters(_fixture.InProcessTestSite, publish: true); + var deploymentParameters = _fixture.GetBaseDeploymentParameters(_fixture.InProcessTestSite); // We need the right dotnet on the path in IIS deploymentParameters.EnvironmentVariables["PATH"] = Path.GetDirectoryName(DotNetCommands.GetDotNetExecutable(deploymentParameters.RuntimeArchitecture)); // ReferenceTestTasks is workaround for https://github.com/dotnet/sdk/issues/2482 @@ -204,7 +204,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests [ConditionalFact] public async Task DetectsOverriddenServer() { - var deploymentParameters = _fixture.GetBaseDeploymentParameters(_fixture.InProcessTestSite, publish: true); + var deploymentParameters = _fixture.GetBaseDeploymentParameters(_fixture.InProcessTestSite); deploymentParameters.TransformArguments((a, _) => $"{a} OverriddenServer"); var deploymentResult = await DeployAsync(deploymentParameters); @@ -221,7 +221,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests [ConditionalFact] public async Task LogsStartupExceptionExitError() { - var deploymentParameters = _fixture.GetBaseDeploymentParameters(_fixture.InProcessTestSite, publish: true); + var deploymentParameters = _fixture.GetBaseDeploymentParameters(_fixture.InProcessTestSite); deploymentParameters.TransformArguments((a, _) => $"{a} Throw"); var deploymentResult = await DeployAsync(deploymentParameters); @@ -239,7 +239,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests [ConditionalFact] public async Task LogsUnexpectedThreadExitError() { - var deploymentParameters = _fixture.GetBaseDeploymentParameters(_fixture.InProcessTestSite, publish: true); + var deploymentParameters = _fixture.GetBaseDeploymentParameters(_fixture.InProcessTestSite); deploymentParameters.TransformArguments((a, _) => $"{a} EarlyReturn"); var deploymentResult = await DeployAsync(deploymentParameters); @@ -256,7 +256,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests [ConditionalFact] public async Task RemoveHostfxrFromApp_InProcessHostfxrAPIAbsent() { - var deploymentParameters = _fixture.GetBaseDeploymentParameters(_fixture.InProcessTestSite, publish: true); + var deploymentParameters = _fixture.GetBaseDeploymentParameters(_fixture.InProcessTestSite); deploymentParameters.ApplicationType = ApplicationType.Standalone; var deploymentResult = await DeployAsync(deploymentParameters); @@ -273,7 +273,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests [RequiresNewShim] public async Task RemoveHostfxrFromApp_InProcessHostfxrLoadFailure() { - var deploymentParameters = _fixture.GetBaseDeploymentParameters(_fixture.InProcessTestSite, publish: true); + var deploymentParameters = _fixture.GetBaseDeploymentParameters(_fixture.InProcessTestSite); deploymentParameters.ApplicationType = ApplicationType.Standalone; var deploymentResult = await DeployAsync(deploymentParameters); @@ -287,7 +287,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests [ConditionalFact] public async Task TargedDifferenceSharedFramework_FailedToFindNativeDependencies() { - var deploymentParameters = _fixture.GetBaseDeploymentParameters(_fixture.InProcessTestSite, publish: true); + var deploymentParameters = _fixture.GetBaseDeploymentParameters(_fixture.InProcessTestSite); var deploymentResult = await DeployAsync(deploymentParameters); Helpers.ModifyFrameworkVersionInRuntimeConfig(deploymentResult); @@ -299,7 +299,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests [ConditionalFact] public async Task RemoveInProcessReference_FailedToFindRequestHandler() { - var deploymentParameters = _fixture.GetBaseDeploymentParameters(_fixture.InProcessTestSite, publish: true); + var deploymentParameters = _fixture.GetBaseDeploymentParameters(_fixture.InProcessTestSite); deploymentParameters.ApplicationType = ApplicationType.Standalone; var deploymentResult = await DeployAsync(deploymentParameters); @@ -320,7 +320,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests [ConditionalFact] public async Task StartupTimeoutIsApplied() { - var deploymentParameters = _fixture.GetBaseDeploymentParameters(_fixture.InProcessTestSite, publish: true); + var deploymentParameters = _fixture.GetBaseDeploymentParameters(_fixture.InProcessTestSite); deploymentParameters.TransformArguments((a, _) => $"{a} Hang"); deploymentParameters.WebConfigActionList.Add( WebConfigHelpers.AddOrModifyAspNetCoreSection("startupTimeLimit", "1")); @@ -340,7 +340,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests [ConditionalFact] public async Task CheckInvalidHostingModelParameter() { - var deploymentParameters = _fixture.GetBaseDeploymentParameters(publish: true); + var deploymentParameters = _fixture.GetBaseDeploymentParameters(); deploymentParameters.WebConfigActionList.Add(WebConfigHelpers.AddOrModifyAspNetCoreSection("hostingModel", "bogus")); var deploymentResult = await DeployAsync(deploymentParameters); @@ -364,7 +364,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests public async Task ReportsWebConfigAuthoringErrors(string scenario) { var (expectedError, action) = InvalidConfigTransformations[scenario]; - var iisDeploymentParameters = _fixture.GetBaseDeploymentParameters(publish: true); + var iisDeploymentParameters = _fixture.GetBaseDeploymentParameters(); iisDeploymentParameters.WebConfigActionList.Add((element, _) => action(element)); var deploymentResult = await DeployAsync(iisDeploymentParameters); var result = await deploymentResult.HttpClient.GetAsync("/HelloWorld"); @@ -409,7 +409,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests public async Task StartsWithWebConfigVariationsPortable(string scenario) { var action = PortableConfigTransformations[scenario]; - var iisDeploymentParameters = _fixture.GetBaseDeploymentParameters(publish: true); + var iisDeploymentParameters = _fixture.GetBaseDeploymentParameters(); var expectedArguments = action(iisDeploymentParameters); var result = await DeployAsync(iisDeploymentParameters); Assert.Equal(expectedArguments, await result.HttpClient.GetStringAsync("/CommandLineArgs")); @@ -473,7 +473,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests public async Task StartsWithWebConfigVariationsStandalone(string scenario) { var action = StandaloneConfigTransformations[scenario]; - var iisDeploymentParameters = _fixture.GetBaseDeploymentParameters(publish: true); + var iisDeploymentParameters = _fixture.GetBaseDeploymentParameters(); iisDeploymentParameters.ApplicationType = ApplicationType.Standalone; var expectedArguments = action(iisDeploymentParameters); var result = await DeployAsync(iisDeploymentParameters); @@ -508,7 +508,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests [RequiresNewHandler] public async Task SetCurrentDirectoryHandlerSettingWorks() { - var deploymentParameters = _fixture.GetBaseDeploymentParameters(publish: true); + var deploymentParameters = _fixture.GetBaseDeploymentParameters(); deploymentParameters.HandlerSettings["SetCurrentDirectory"] = "false"; var deploymentResult = await DeployAsync(deploymentParameters); diff --git a/src/Servers/IIS/IIS/test/Common.FunctionalTests/LogFileTests.cs b/src/Servers/IIS/IIS/test/Common.FunctionalTests/LogFileTests.cs index 24d59746e4d..eac971ac332 100644 --- a/src/Servers/IIS/IIS/test/Common.FunctionalTests/LogFileTests.cs +++ b/src/Servers/IIS/IIS/test/Common.FunctionalTests/LogFileTests.cs @@ -45,7 +45,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests private async Task CheckStdoutToFile(TestVariant variant, string path) { - var deploymentParameters = _fixture.GetBaseDeploymentParameters(variant, publish: true); + var deploymentParameters = _fixture.GetBaseDeploymentParameters(variant); deploymentParameters.EnableLogging(_logFolderPath); var deploymentResult = await DeployAsync(deploymentParameters); @@ -64,7 +64,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests [MemberData(nameof(TestVariants))] public async Task InvalidFilePathForLogs_ServerStillRuns(TestVariant variant) { - var deploymentParameters = _fixture.GetBaseDeploymentParameters(variant, publish: true); + var deploymentParameters = _fixture.GetBaseDeploymentParameters(variant); deploymentParameters.WebConfigActionList.Add( WebConfigHelpers.AddOrModifyAspNetCoreSection("stdoutLogEnabled", "true")); @@ -88,7 +88,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests [RequiresNewShim] public async Task StartupMessagesAreLoggedIntoDebugLogFile(TestVariant variant) { - var deploymentParameters = _fixture.GetBaseDeploymentParameters(variant, publish: true); + var deploymentParameters = _fixture.GetBaseDeploymentParameters(variant); deploymentParameters.HandlerSettings["debugLevel"] = "file"; deploymentParameters.HandlerSettings["debugFile"] = "subdirectory\\debug.txt"; @@ -103,7 +103,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests [MemberData(nameof(TestVariants))] public async Task StartupMessagesAreLoggedIntoDefaultDebugLogFile(TestVariant variant) { - var deploymentParameters = _fixture.GetBaseDeploymentParameters(variant, publish: true); + var deploymentParameters = _fixture.GetBaseDeploymentParameters(variant); deploymentParameters.HandlerSettings["debugLevel"] = "file"; var deploymentResult = await DeployAsync(deploymentParameters); @@ -118,7 +118,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests [MemberData(nameof(TestVariants))] public async Task StartupMessagesAreLoggedIntoDefaultDebugLogFileWhenEnabledWithEnvVar(TestVariant variant) { - var deploymentParameters = _fixture.GetBaseDeploymentParameters(variant, publish: true); + var deploymentParameters = _fixture.GetBaseDeploymentParameters(variant); deploymentParameters.EnvironmentVariables["ASPNETCORE_MODULE_DEBUG"] = "file"; // Add empty debugFile handler setting to prevent IIS deployer from overriding debug settings deploymentParameters.HandlerSettings["debugFile"] = ""; @@ -139,7 +139,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests try { - var deploymentParameters = _fixture.GetBaseDeploymentParameters(variant, publish: true); + var deploymentParameters = _fixture.GetBaseDeploymentParameters(variant); deploymentParameters.EnvironmentVariables["ASPNETCORE_MODULE_DEBUG_FILE"] = firstTempFile; deploymentParameters.AddDebugLogToWebConfig(secondTempFile); @@ -166,7 +166,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests public async Task DebugLogsAreWrittenToEventLog(TestVariant variant) { - var deploymentParameters = _fixture.GetBaseDeploymentParameters(variant, publish: true); + var deploymentParameters = _fixture.GetBaseDeploymentParameters(variant); deploymentParameters.HandlerSettings["debugLevel"] = "file,eventlog"; var deploymentResult = await StartAsync(deploymentParameters); StopServer(); @@ -179,7 +179,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests { var path = "CheckConsoleFunctions"; - var deploymentParameters = _fixture.GetBaseDeploymentParameters(_fixture.InProcessTestSite, variant.HostingModel, publish: true); + var deploymentParameters = _fixture.GetBaseDeploymentParameters(_fixture.InProcessTestSite, variant.HostingModel); deploymentParameters.TransformArguments((a, _) => $"{a} {path}"); // For standalone this will need to remove space var logFolderPath = _logFolderPath + "\\彡⾔"; @@ -210,7 +210,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests [MemberData(nameof(TestVariants))] public async Task OnlyOneFileCreatedWithProcessStartTime(TestVariant variant) { - var deploymentParameters = _fixture.GetBaseDeploymentParameters(variant, publish: true); + var deploymentParameters = _fixture.GetBaseDeploymentParameters(variant); deploymentParameters.EnableLogging(_logFolderPath); diff --git a/src/Servers/IIS/IIS/test/Common.FunctionalTests/MultiApplicationTests.cs b/src/Servers/IIS/IIS/test/Common.FunctionalTests/MultiApplicationTests.cs index 80c7f95c268..1745fac1cd2 100644 --- a/src/Servers/IIS/IIS/test/Common.FunctionalTests/MultiApplicationTests.cs +++ b/src/Servers/IIS/IIS/test/Common.FunctionalTests/MultiApplicationTests.cs @@ -31,7 +31,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests [ConditionalFact] public async Task RunsTwoOutOfProcessApps() { - var parameters = _fixture.GetBaseDeploymentParameters(HostingModel.OutOfProcess, publish: true); + var parameters = _fixture.GetBaseDeploymentParameters(HostingModel.OutOfProcess); parameters.ServerConfigActionList.Add(DuplicateApplication); var result = await DeployAsync(parameters); var id1 = await result.HttpClient.GetStringAsync("/app1/ProcessId"); @@ -42,7 +42,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests [ConditionalFact] public async Task FailsAndLogsWhenRunningTwoInProcessApps() { - var parameters = _fixture.GetBaseDeploymentParameters(HostingModel.InProcess, publish: true); + var parameters = _fixture.GetBaseDeploymentParameters(HostingModel.InProcess); parameters.ServerConfigActionList.Add(DuplicateApplication); var result = await DeployAsync(parameters); @@ -59,7 +59,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests [InlineData(HostingModel.InProcess)] public async Task FailsAndLogsEventLogForMixedHostingModel(HostingModel firstApp) { - var parameters = _fixture.GetBaseDeploymentParameters(firstApp, publish: true); + var parameters = _fixture.GetBaseDeploymentParameters(firstApp); parameters.ServerConfigActionList.Add(DuplicateApplication); var result = await DeployAsync(parameters); diff --git a/src/Servers/IIS/IIS/test/Common.FunctionalTests/OutOfProcess/AspNetCorePortTests.cs b/src/Servers/IIS/IIS/test/Common.FunctionalTests/OutOfProcess/AspNetCorePortTests.cs index 3e26d5af683..901c605f280 100644 --- a/src/Servers/IIS/IIS/test/Common.FunctionalTests/OutOfProcess/AspNetCorePortTests.cs +++ b/src/Servers/IIS/IIS/test/Common.FunctionalTests/OutOfProcess/AspNetCorePortTests.cs @@ -46,7 +46,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests public async Task EnvVarInWebConfig_Valid(TestVariant variant) { // Must publish to set env vars in web.config - var deploymentParameters = _fixture.GetBaseDeploymentParameters(variant, publish: true); + var deploymentParameters = _fixture.GetBaseDeploymentParameters(variant); var port = GetUnusedRandomPort(); deploymentParameters.WebConfigBasedEnvironmentVariables["ASPNETCORE_PORT"] = port.ToString(); @@ -62,7 +62,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests public async Task EnvVarInWebConfig_Empty(TestVariant variant) { // Must publish to set env vars in web.config - var deploymentParameters = _fixture.GetBaseDeploymentParameters(variant, publish: true); + var deploymentParameters = _fixture.GetBaseDeploymentParameters(variant); deploymentParameters.WebConfigBasedEnvironmentVariables["ASPNETCORE_PORT"] = string.Empty; var deploymentResult = await DeployAsync(deploymentParameters); @@ -78,7 +78,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests public async Task EnvVarInWebConfig_Invalid(TestVariant variant, string port) { // Must publish to set env vars in web.config - var deploymentParameters = _fixture.GetBaseDeploymentParameters(variant, publish: true); + var deploymentParameters = _fixture.GetBaseDeploymentParameters(variant); deploymentParameters.WebConfigBasedEnvironmentVariables["ASPNETCORE_PORT"] = port; var deploymentResult = await DeployAsync(deploymentParameters); diff --git a/src/Servers/IIS/IIS/test/Common.FunctionalTests/OutOfProcess/GlobalVersionTests.cs b/src/Servers/IIS/IIS/test/Common.FunctionalTests/OutOfProcess/GlobalVersionTests.cs index f9e6836b6fc..8b97cd2cb09 100644 --- a/src/Servers/IIS/IIS/test/Common.FunctionalTests/OutOfProcess/GlobalVersionTests.cs +++ b/src/Servers/IIS/IIS/test/Common.FunctionalTests/OutOfProcess/GlobalVersionTests.cs @@ -184,7 +184,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests private IISDeploymentParameters GetGlobalVersionBaseDeploymentParameters() { - return _fixture.GetBaseDeploymentParameters(HostingModel.OutOfProcess, publish: true); + return _fixture.GetBaseDeploymentParameters(HostingModel.OutOfProcess); } private void CopyDirectory(string from, string to) diff --git a/src/Servers/IIS/IIS/test/Common.FunctionalTests/PublishedApplicationPublisher.cs b/src/Servers/IIS/IIS/test/Common.FunctionalTests/PublishedApplicationPublisher.cs index 0371d323a25..3e098189335 100644 --- a/src/Servers/IIS/IIS/test/Common.FunctionalTests/PublishedApplicationPublisher.cs +++ b/src/Servers/IIS/IIS/test/Common.FunctionalTests/PublishedApplicationPublisher.cs @@ -1,24 +1,54 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +using System; using System.IO; using System.Reflection; using System.Threading.Tasks; using Microsoft.AspNetCore.Server.IntegrationTesting; +using Microsoft.AspNetCore.Testing; using Microsoft.Extensions.Logging; namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests { public class PublishedApplicationPublisher: ApplicationPublisher { - private readonly string _applicationPath; + private readonly string _applicationName; - public PublishedApplicationPublisher(string applicationPath) : base(applicationPath) + public PublishedApplicationPublisher(string applicationName) : base(applicationName) { - _applicationPath = applicationPath; + _applicationName = applicationName; } public override Task<PublishedApplication> Publish(DeploymentParameters deploymentParameters, ILogger logger) + { + var path = Path.Combine(AppContext.BaseDirectory, GetProfileName(deploymentParameters)); + + if (!Directory.Exists(path)) + { + var solutionPath = GetProjectReferencePublishLocation(deploymentParameters); + logger.LogInformation("{PublishDir} doesn't exist falling back to solution based path {SolutionBasedDir}", solutionPath, solutionPath); + path = solutionPath; + } + + logger.LogInformation("Using prepublished application from {PublishDir}", path); + + var target = CreateTempDirectory(); + + var source = new DirectoryInfo(path); + CachingApplicationPublisher.CopyFiles(source, target, logger); + return Task.FromResult(new PublishedApplication(target.FullName, logger)); + } + + private string GetProjectReferencePublishLocation(DeploymentParameters deploymentParameters) + { + var testAssetsBasePath = Path.Combine(TestPathUtilities.GetSolutionRootDirectory("IISIntegration"), "IIS", "test", "testassets", _applicationName); + var configuration = this.GetType().GetTypeInfo().Assembly.GetCustomAttribute<AssemblyConfigurationAttribute>().Configuration; + var path = Path.Combine(testAssetsBasePath, "bin", configuration, deploymentParameters.TargetFramework, "publish", GetProfileName(deploymentParameters)); + return path; + } + + private string GetProfileName(DeploymentParameters deploymentParameters) { // Treat AdditionalPublishParameters as profile name if defined string profileName; @@ -35,16 +65,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests profileName = "Standalone-" + deploymentParameters.RuntimeArchitecture; } - var configuration = this.GetType().GetTypeInfo().Assembly.GetCustomAttribute<AssemblyConfigurationAttribute>().Configuration; - - var path = Path.Combine(_applicationPath, "bin", configuration, deploymentParameters.TargetFramework, "publish", profileName); - logger.LogInformation("Using prepublished application from {PublishDir}", path); - - var target = CreateTempDirectory(); - - var source = new DirectoryInfo(path); - CachingApplicationPublisher.CopyFiles(source, target, logger); - return Task.FromResult(new PublishedApplication(target.FullName, logger)); + return Path.GetFileNameWithoutExtension(_applicationName) + "-" + profileName; } } } diff --git a/src/Servers/IIS/IIS/test/Common.FunctionalTests/PublishedSitesFixture.cs b/src/Servers/IIS/IIS/test/Common.FunctionalTests/PublishedSitesFixture.cs index 7968edc82a6..1f9df5e01c8 100644 --- a/src/Servers/IIS/IIS/test/Common.FunctionalTests/PublishedSitesFixture.cs +++ b/src/Servers/IIS/IIS/test/Common.FunctionalTests/PublishedSitesFixture.cs @@ -19,44 +19,46 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests public class PublishedSitesFixture : IDisposable { - public PublishedApplicationPublisher InProcessTestSite { get; } = new PublishedApplicationPublisher(Helpers.GetInProcessTestSitesPath()); - public PublishedApplicationPublisher OutOfProcessTestSite { get; } = new PublishedApplicationPublisher(Helpers.GetOutOfProcessTestSitesPath()); + public PublishedApplicationPublisher InProcessTestSite { get; } = new PublishedApplicationPublisher(Helpers.GetInProcessTestSitesName()); + public PublishedApplicationPublisher OutOfProcessTestSite { get; } = new PublishedApplicationPublisher(Helpers.GetOutOfProcessTestSitesName()); public void Dispose() { } - public IISDeploymentParameters GetBaseDeploymentParameters(HostingModel hostingModel = HostingModel.InProcess, bool publish = false) + public IISDeploymentParameters GetBaseDeploymentParameters(HostingModel hostingModel = HostingModel.InProcess) { var publisher = hostingModel == HostingModel.InProcess ? InProcessTestSite : OutOfProcessTestSite; - return GetBaseDeploymentParameters(publisher, hostingModel, publish); + return GetBaseDeploymentParameters(publisher, hostingModel); } - public IISDeploymentParameters GetBaseDeploymentParameters(TestVariant variant, bool publish = false) + + public IISDeploymentParameters GetBaseDeploymentParameters(TestVariant variant) { var publisher = variant.HostingModel == HostingModel.InProcess ? InProcessTestSite : OutOfProcessTestSite; - return GetBaseDeploymentParameters(publisher, new DeploymentParameters(variant), publish); + return GetBaseDeploymentParameters(publisher, new DeploymentParameters(variant)); } - public IISDeploymentParameters GetBaseDeploymentParameters(ApplicationPublisher publisher, HostingModel hostingModel = HostingModel.InProcess, bool publish = false) + public IISDeploymentParameters GetBaseDeploymentParameters(ApplicationPublisher publisher, HostingModel hostingModel = HostingModel.InProcess) { return GetBaseDeploymentParameters( publisher, - new DeploymentParameters(publisher.ApplicationPath, DeployerSelector.ServerType, RuntimeFlavor.CoreClr, RuntimeArchitecture.x64) + new DeploymentParameters() { + ServerType = DeployerSelector.ServerType, + RuntimeFlavor = RuntimeFlavor.CoreClr, + RuntimeArchitecture = RuntimeArchitecture.x64, HostingModel = hostingModel, TargetFramework = Tfm.NetCoreApp30, AncmVersion = AncmVersion.AspNetCoreModuleV2 - }, - publish); + }); } - public IISDeploymentParameters GetBaseDeploymentParameters(ApplicationPublisher publisher, DeploymentParameters baseParameters, bool publish = false) + public IISDeploymentParameters GetBaseDeploymentParameters(ApplicationPublisher publisher, DeploymentParameters baseParameters) { return new IISDeploymentParameters(baseParameters) { ApplicationPublisher = publisher, - ApplicationPath = publisher.ApplicationPath, - PublishApplicationBeforeDeployment = publish + PublishApplicationBeforeDeployment = true }; } } diff --git a/src/Servers/IIS/IIS/test/Common.FunctionalTests/Utilities/Helpers.cs b/src/Servers/IIS/IIS/test/Common.FunctionalTests/Utilities/Helpers.cs index 2f734ac909d..0c299af7b4c 100644 --- a/src/Servers/IIS/IIS/test/Common.FunctionalTests/Utilities/Helpers.cs +++ b/src/Servers/IIS/IIS/test/Common.FunctionalTests/Utilities/Helpers.cs @@ -23,17 +23,12 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests private static readonly TimeSpan RetryRequestDelay = TimeSpan.FromMilliseconds(100); private static readonly int RetryRequestCount = 10; - public static string GetTestWebSitePath(string name) + public static string GetInProcessTestSitesName() { - return Path.Combine(TestPathUtilities.GetSolutionRootDirectory("IISIntegration"),"IIS", "test", "testassets", name); + return DeployerSelector.IsForwardsCompatibilityTest ? "InProcessForwardsCompatWebSite" : "InProcessWebSite"; } - public static string GetInProcessTestSitesPath() - { - return DeployerSelector.IsForwardsCompatibilityTest ? GetTestWebSitePath("InProcessForwardsCompatWebSite") : GetTestWebSitePath("InProcessWebSite"); - } - - public static string GetOutOfProcessTestSitesPath() => GetTestWebSitePath("OutOfProcessWebSite"); + public static string GetOutOfProcessTestSitesName() => "OutOfProcessWebSite"; public static async Task AssertStarts(this IISDeploymentResult deploymentResult, string path = "/HelloWorld") { diff --git a/src/Servers/IIS/IIS/test/Common.FunctionalTests/Utilities/IISTestSiteFixture.cs b/src/Servers/IIS/IIS/test/Common.FunctionalTests/Utilities/IISTestSiteFixture.cs index 253671778eb..65c20f700cd 100644 --- a/src/Servers/IIS/IIS/test/Common.FunctionalTests/Utilities/IISTestSiteFixture.cs +++ b/src/Servers/IIS/IIS/test/Common.FunctionalTests/Utilities/IISTestSiteFixture.cs @@ -19,7 +19,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests private static void Configure(IISDeploymentParameters deploymentParameters) { - deploymentParameters.ApplicationPath = Helpers.GetOutOfProcessTestSitesPath(); + deploymentParameters.ApplicationPublisher = new PublishedApplicationPublisher(Helpers.GetOutOfProcessTestSitesName());; deploymentParameters.HostingModel = HostingModel.OutOfProcess; } } @@ -32,7 +32,8 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests private static void Configure(IISDeploymentParameters deploymentParameters) { - deploymentParameters.ApplicationPath = Helpers.GetOutOfProcessTestSitesPath(); + deploymentParameters.ApplicationPublisher = new PublishedApplicationPublisher(Helpers.GetOutOfProcessTestSitesName());; + deploymentParameters.ApplicationPath = Helpers.GetOutOfProcessTestSitesName(); deploymentParameters.HostingModel = HostingModel.OutOfProcess; deploymentParameters.AncmVersion = AncmVersion.AspNetCoreModule; } @@ -108,21 +109,20 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests return; } - var deploymentParameters = new IISDeploymentParameters(Helpers.GetInProcessTestSitesPath(), - DeployerSelector.ServerType, - RuntimeFlavor.CoreClr, - RuntimeArchitecture.x64) + var deploymentParameters = new IISDeploymentParameters() { + RuntimeArchitecture = RuntimeArchitecture.x64, + RuntimeFlavor = RuntimeFlavor.CoreClr, TargetFramework = Tfm.NetCoreApp30, AncmVersion = AncmVersion.AspNetCoreModuleV2, HostingModel = HostingModel.InProcess, - PublishApplicationBeforeDeployment = true + PublishApplicationBeforeDeployment = true, + ApplicationPublisher = new PublishedApplicationPublisher(Helpers.GetInProcessTestSitesName()), + ServerType = DeployerSelector.ServerType }; _configure(deploymentParameters); - deploymentParameters.ApplicationPublisher = new PublishedApplicationPublisher(deploymentParameters.ApplicationPath); - _deployer = IISApplicationDeployerFactory.Create(deploymentParameters, _loggerFactory); _deploymentResult = (IISDeploymentResult)_deployer.DeployAsync().Result; } diff --git a/src/Servers/IIS/IIS/test/IIS.Shared.FunctionalTests/Inprocess/StdOutRedirectionTests.cs b/src/Servers/IIS/IIS/test/IIS.Shared.FunctionalTests/Inprocess/StdOutRedirectionTests.cs index 83397ea8768..4ee7ea2dd96 100644 --- a/src/Servers/IIS/IIS/test/IIS.Shared.FunctionalTests/Inprocess/StdOutRedirectionTests.cs +++ b/src/Servers/IIS/IIS/test/IIS.Shared.FunctionalTests/Inprocess/StdOutRedirectionTests.cs @@ -27,7 +27,7 @@ namespace IIS.FunctionalTests.Inprocess [ConditionalFact] public async Task FrameworkNotFoundExceptionLogged_Pipe() { - var deploymentParameters = _fixture.GetBaseDeploymentParameters(_fixture.InProcessTestSite, publish: true); + var deploymentParameters = _fixture.GetBaseDeploymentParameters(_fixture.InProcessTestSite); var deploymentResult = await DeployAsync(deploymentParameters); @@ -46,7 +46,7 @@ namespace IIS.FunctionalTests.Inprocess public async Task FrameworkNotFoundExceptionLogged_File() { var deploymentParameters = - _fixture.GetBaseDeploymentParameters(_fixture.InProcessTestSite, publish: true); + _fixture.GetBaseDeploymentParameters(_fixture.InProcessTestSite); deploymentParameters.EnableLogging(_logFolderPath); @@ -71,7 +71,7 @@ namespace IIS.FunctionalTests.Inprocess public async Task EnableCoreHostTraceLogging_TwoLogFilesCreated() { var deploymentParameters = - _fixture.GetBaseDeploymentParameters(_fixture.InProcessTestSite, publish: true); + _fixture.GetBaseDeploymentParameters(_fixture.InProcessTestSite); deploymentParameters.TransformArguments((a, _) => $"{a} CheckLargeStdOutWrites"); deploymentParameters.EnvironmentVariables["COREHOST_TRACE"] = "1"; @@ -100,7 +100,7 @@ namespace IIS.FunctionalTests.Inprocess [InlineData("CheckOversizedStdOutWrites")] public async Task EnableCoreHostTraceLogging_PipeCaptureNativeLogs(string path) { - var deploymentParameters = _fixture.GetBaseDeploymentParameters(_fixture.InProcessTestSite, publish: true); + var deploymentParameters = _fixture.GetBaseDeploymentParameters(_fixture.InProcessTestSite); deploymentParameters.EnvironmentVariables["COREHOST_TRACE"] = "1"; deploymentParameters.TransformArguments((a, _) => $"{a} {path}"); @@ -125,7 +125,7 @@ namespace IIS.FunctionalTests.Inprocess public async Task EnableCoreHostTraceLogging_FileCaptureNativeLogs(string path) { var deploymentParameters = - _fixture.GetBaseDeploymentParameters(_fixture.InProcessTestSite, publish: true); + _fixture.GetBaseDeploymentParameters(_fixture.InProcessTestSite); deploymentParameters.EnvironmentVariables["COREHOST_TRACE"] = "1"; deploymentParameters.TransformArguments((a, _) => $"{a} {path}"); diff --git a/src/Servers/IIS/IIS/test/IIS.Shared.FunctionalTests/ServicesTests.cs b/src/Servers/IIS/IIS/test/IIS.Shared.FunctionalTests/ServicesTests.cs index c4cc11637bd..6659d38d35e 100644 --- a/src/Servers/IIS/IIS/test/IIS.Shared.FunctionalTests/ServicesTests.cs +++ b/src/Servers/IIS/IIS/test/IIS.Shared.FunctionalTests/ServicesTests.cs @@ -35,7 +35,7 @@ namespace IIS.FunctionalTests // This test often hits a memory leak in warmup.dll module, it has been reported to IIS team using (AppVerifier.Disable(DeployerSelector.ServerType, 0x900)) { - var baseDeploymentParameters = _fixture.GetBaseDeploymentParameters(hostingModel, publish: true); + var baseDeploymentParameters = _fixture.GetBaseDeploymentParameters(hostingModel); baseDeploymentParameters.TransformArguments( (args, contentRoot) => $"{args} CreateFile \"{Path.Combine(contentRoot, "Started.txt")}\""); EnablePreload(baseDeploymentParameters); @@ -58,7 +58,7 @@ namespace IIS.FunctionalTests // This test often hits a memory leak in warmup.dll module, it has been reported to IIS team using (AppVerifier.Disable(DeployerSelector.ServerType, 0x900)) { - var baseDeploymentParameters = _fixture.GetBaseDeploymentParameters(hostingModel, publish: true); + var baseDeploymentParameters = _fixture.GetBaseDeploymentParameters(hostingModel); EnablePreload(baseDeploymentParameters); baseDeploymentParameters.ServerConfigActionList.Add( diff --git a/src/Servers/IIS/IIS/test/IISExpress.FunctionalTests/IISExpress.FunctionalTests.csproj b/src/Servers/IIS/IIS/test/IISExpress.FunctionalTests/IISExpress.FunctionalTests.csproj index 33f7f6712c1..dd2bcc8e458 100644 --- a/src/Servers/IIS/IIS/test/IISExpress.FunctionalTests/IISExpress.FunctionalTests.csproj +++ b/src/Servers/IIS/IIS/test/IISExpress.FunctionalTests/IISExpress.FunctionalTests.csproj @@ -1,4 +1,4 @@ -<Project Sdk="Microsoft.NET.Sdk"> +<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <TargetFramework>netcoreapp3.0</TargetFramework> diff --git a/src/Servers/IIS/IIS/test/IISExpress.FunctionalTests/InProcess/AuthenticationTests.cs b/src/Servers/IIS/IIS/test/IISExpress.FunctionalTests/InProcess/AuthenticationTests.cs index 47fb3a6553e..2c4eb88fed6 100644 --- a/src/Servers/IIS/IIS/test/IISExpress.FunctionalTests/InProcess/AuthenticationTests.cs +++ b/src/Servers/IIS/IIS/test/IISExpress.FunctionalTests/InProcess/AuthenticationTests.cs @@ -25,7 +25,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests [RequiresIIS(IISCapability.WindowsAuthentication)] public async Task Authentication_InProcess() { - var deploymentParameters = _fixture.GetBaseDeploymentParameters(publish: true); + var deploymentParameters = _fixture.GetBaseDeploymentParameters(); deploymentParameters.SetWindowsAuth(); var deploymentResult = await DeployAsync(deploymentParameters); diff --git a/src/Servers/IIS/IIS/test/IISExpress.FunctionalTests/InProcess/IISExpressShutdownTests.cs b/src/Servers/IIS/IIS/test/IISExpress.FunctionalTests/InProcess/IISExpressShutdownTests.cs index bca40e68159..4edad3580f5 100644 --- a/src/Servers/IIS/IIS/test/IISExpress.FunctionalTests/InProcess/IISExpressShutdownTests.cs +++ b/src/Servers/IIS/IIS/test/IISExpress.FunctionalTests/InProcess/IISExpressShutdownTests.cs @@ -27,7 +27,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests [ConditionalFact] public async Task ServerShutsDownWhenMainExits() { - var parameters = _fixture.GetBaseDeploymentParameters(publish: true); + var parameters = _fixture.GetBaseDeploymentParameters(); var deploymentResult = await DeployAsync(parameters); try { @@ -45,7 +45,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests [ConditionalFact] public async Task ServerShutsDownWhenMainExitsStress() { - var parameters = _fixture.GetBaseDeploymentParameters(publish: true); + var parameters = _fixture.GetBaseDeploymentParameters(); var deploymentResult = await StartAsync(parameters); var load = Helpers.StressLoad(deploymentResult.HttpClient, "/HelloWorld", response => { @@ -69,7 +69,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests [ConditionalFact] public async Task GracefulShutdown_DoesNotCrashProcess() { - var parameters = _fixture.GetBaseDeploymentParameters(publish: true); + var parameters = _fixture.GetBaseDeploymentParameters(); var result = await DeployAsync(parameters); var response = await result.HttpClient.GetAsync("/HelloWorld"); @@ -80,7 +80,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests [ConditionalFact] public async Task ForcefulShutdown_DoesCrashProcess() { - var parameters = _fixture.GetBaseDeploymentParameters(publish: true); + var parameters = _fixture.GetBaseDeploymentParameters(); var result = await DeployAsync(parameters); var response = await result.HttpClient.GetAsync("/HelloWorld"); diff --git a/src/Servers/IIS/IIS/test/IISExpress.FunctionalTests/UpgradeFeatureDetectionTests.cs b/src/Servers/IIS/IIS/test/IISExpress.FunctionalTests/UpgradeFeatureDetectionTests.cs index 62d07c5fd94..d1278997c82 100644 --- a/src/Servers/IIS/IIS/test/IISExpress.FunctionalTests/UpgradeFeatureDetectionTests.cs +++ b/src/Servers/IIS/IIS/test/IISExpress.FunctionalTests/UpgradeFeatureDetectionTests.cs @@ -29,7 +29,6 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests // fails due to not modifying the apphost.config file. return UpgradeFeatureDetectionDeployer( disableWebSocket: true, - Helpers.GetInProcessTestSitesPath(), "Disabled", HostingModel.InProcess); } @@ -38,7 +37,6 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests { return UpgradeFeatureDetectionDeployer( disableWebSocket: false, - Helpers.GetInProcessTestSitesPath(), _isWebsocketsSupported, HostingModel.InProcess); } @@ -47,7 +45,6 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests { return UpgradeFeatureDetectionDeployer( disableWebSocket: true, - Helpers.GetOutOfProcessTestSitesPath(), "Disabled", HostingModel.OutOfProcess); } @@ -56,13 +53,12 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests { return UpgradeFeatureDetectionDeployer( disableWebSocket: false, - Helpers.GetOutOfProcessTestSitesPath(), _isWebsocketsSupported, HostingModel.OutOfProcess); } - private async Task UpgradeFeatureDetectionDeployer(bool disableWebSocket, string sitePath, string expected, HostingModel hostingModel) + private async Task UpgradeFeatureDetectionDeployer(bool disableWebSocket, string expected, HostingModel hostingModel) { - var deploymentParameters = _fixture.GetBaseDeploymentParameters(hostingModel, publish: true); + var deploymentParameters = _fixture.GetBaseDeploymentParameters(hostingModel); if (disableWebSocket) { diff --git a/src/Servers/IIS/IIS/test/testassets/InProcessForwardsCompatWebSite/InProcessWebSite.csproj b/src/Servers/IIS/IIS/test/testassets/InProcessForwardsCompatWebSite/InProcessWebSite.csproj index 71bf14e59dd..57e5d81f7f0 100644 --- a/src/Servers/IIS/IIS/test/testassets/InProcessForwardsCompatWebSite/InProcessWebSite.csproj +++ b/src/Servers/IIS/IIS/test/testassets/InProcessForwardsCompatWebSite/InProcessWebSite.csproj @@ -4,6 +4,7 @@ <PropertyGroup> <TargetFramework>netcoreapp3.0</TargetFramework> + <TestAssetOutputName>InProcessForwardsCompatWebSite</TestAssetOutputName> </PropertyGroup> <ItemGroup Condition="'$(OS)' == 'Windows_NT'"> diff --git a/src/Servers/IIS/IntegrationTesting.IIS/src/IISDeploymentParameters.cs b/src/Servers/IIS/IntegrationTesting.IIS/src/IISDeploymentParameters.cs index 3b2dfc4804d..04d4dfa7ce7 100644 --- a/src/Servers/IIS/IntegrationTesting.IIS/src/IISDeploymentParameters.cs +++ b/src/Servers/IIS/IntegrationTesting.IIS/src/IISDeploymentParameters.cs @@ -19,10 +19,10 @@ namespace Microsoft.AspNetCore.Server.IntegrationTesting.IIS } public IISDeploymentParameters( - string applicationPath, - ServerType serverType, - RuntimeFlavor runtimeFlavor, - RuntimeArchitecture runtimeArchitecture) + string applicationPath, + ServerType serverType, + RuntimeFlavor runtimeFlavor, + RuntimeArchitecture runtimeArchitecture) : base(applicationPath, serverType, runtimeFlavor, runtimeArchitecture) { } diff --git a/src/Servers/IIS/IntegrationTesting.IIS/src/IISExpressDeployer.cs b/src/Servers/IIS/IntegrationTesting.IIS/src/IISExpressDeployer.cs index ed910a4c30d..f1279fac244 100644 --- a/src/Servers/IIS/IntegrationTesting.IIS/src/IISExpressDeployer.cs +++ b/src/Servers/IIS/IntegrationTesting.IIS/src/IISExpressDeployer.cs @@ -115,27 +115,30 @@ namespace Microsoft.AspNetCore.Server.IntegrationTesting.IIS private string CheckIfPublishIsRequired() { + string dllRoot = null; var targetFramework = DeploymentParameters.TargetFramework; - - // IISIntegration uses this layout - var dllRoot = Path.Combine(DeploymentParameters.ApplicationPath, "bin", DeploymentParameters.RuntimeArchitecture.ToString(), - DeploymentParameters.Configuration, targetFramework); - - if (!Directory.Exists(dllRoot)) + if (!string.IsNullOrEmpty(DeploymentParameters.ApplicationPath)) { - // Most repos use this layout - dllRoot = Path.Combine(DeploymentParameters.ApplicationPath, "bin", DeploymentParameters.Configuration, targetFramework); + // IISIntegration uses this layout + dllRoot = Path.Combine(DeploymentParameters.ApplicationPath, "bin", DeploymentParameters.RuntimeArchitecture.ToString(), + DeploymentParameters.Configuration, targetFramework); if (!Directory.Exists(dllRoot)) { - // The bits we need weren't pre-compiled, compile on publish - DeploymentParameters.PublishApplicationBeforeDeployment = true; - } - else if (DeploymentParameters.RuntimeFlavor == RuntimeFlavor.Clr - && DeploymentParameters.RuntimeArchitecture == RuntimeArchitecture.x86) - { - // x64 is the default. Publish to rebuild for the right bitness - DeploymentParameters.PublishApplicationBeforeDeployment = true; + // Most repos use this layout + dllRoot = Path.Combine(DeploymentParameters.ApplicationPath, "bin", DeploymentParameters.Configuration, targetFramework); + + if (!Directory.Exists(dllRoot)) + { + // The bits we need weren't pre-compiled, compile on publish + DeploymentParameters.PublishApplicationBeforeDeployment = true; + } + else if (DeploymentParameters.RuntimeFlavor == RuntimeFlavor.Clr + && DeploymentParameters.RuntimeArchitecture == RuntimeArchitecture.x86) + { + // x64 is the default. Publish to rebuild for the right bitness + DeploymentParameters.PublishApplicationBeforeDeployment = true; + } } } diff --git a/src/Servers/IIS/build/testsite.props b/src/Servers/IIS/build/testsite.props index 3afdd22f257..c0bdaf0e0da 100644 --- a/src/Servers/IIS/build/testsite.props +++ b/src/Servers/IIS/build/testsite.props @@ -6,10 +6,12 @@ <IISExpressAppHostConfig>$(MSBuildThisFileDirectory)applicationhost.config</IISExpressAppHostConfig> <IISAppHostConfig>$(MSBuildThisFileDirectory)applicationhost.iis.config</IISAppHostConfig> <PreserveCompilationContext>false</PreserveCompilationContext> - <DisableFastUpToDateCheck>True</DisableFastUpToDateCheck> + <DisableFastUpToDateCheck>true</DisableFastUpToDateCheck> <!-- Work around until we get a new WebSdk --> <AspNetCoreHostingModel>OutOfProcess</AspNetCoreHostingModel> - <BuildProjectReferences Condition="'$(_InsidePublishTestsAssets)' == 'True'">False</BuildProjectReferences> + <HasTestAssetProfile Condition="'$(TestAssetProfile)' != ''">true</HasTestAssetProfile> + <AppendRuntimeIdentifierToOutputPath Condition="'$(HasTestAssetProfile)' == 'true'">false</AppendRuntimeIdentifierToOutputPath> + <TestAssetOutputName Condition="'$(TestAssetOutputName)' == ''">$(MSBuildProjectName)</TestAssetOutputName> </PropertyGroup> <Import Project="assets.props" /> @@ -26,14 +28,6 @@ <NativeFolder>x64</NativeFolder> </PropertyGroup> - <PropertyGroup> - <!-- For standalone publish, all dlls are flattened to the same folder. - Set the base path to the request handler - --> - <BasePathForRequestHandler Condition="'$(RuntimeIdentifier)' == ''">$(NativePlatform)\</BasePathForRequestHandler> - - </PropertyGroup> - <PropertyGroup> <IISExpressArguments>/config:"$(IISExpressAppHostConfig)" /systray:false</IISExpressArguments> <IISArguments>-h "$(IISAppHostConfig)"</IISArguments> @@ -50,7 +44,7 @@ <!-- Deps file injection--> <ItemGroup Condition="('$(InProcessTestSite)' == 'true') AND ('$(ReferenceTestTasks)' != 'false')"> <ProjectReference Include="$(MSBuildThisFileDirectory)..\IIS\test\testassets\TestTasks\TestTasks.csproj"> - <ReferenceOutputAssembly>False</ReferenceOutputAssembly> + <ReferenceOutputAssembly>false</ReferenceOutputAssembly> </ProjectReference> </ItemGroup> @@ -64,7 +58,6 @@ </PropertyGroup> </Target> - <Target Name="InjectRequestHandler" Condition=" '$(InProcessTestSite)' == 'true' AND '$(BuildIisNativeProjects)' == 'true' AND '$(TargetFrameworkIdentifier)' != '.NETFramework'" AfterTargets="GenerateBuildDependencyFile" @@ -79,7 +72,24 @@ <Exec Command="$(InjectDepsApp) "$(PublishDepsFilePath)" $(RuntimeIdentifier) " /> </Target> - <Target Name="PublishTestsAssets" AfterTargets="Build" Condition="'$(_InsidePublishTestsAssets)' != 'true' AND '@(TestAssetPublishProfile->Count())' != '0'"> + <Target Name="PreventProjectReferencesFromBuilding" BeforeTargets="BeforeResolveReferences" Condition="'@(TestAssetPublishProfile->Count())' != '0'"> + <PropertyGroup> + <BuildProjectReferences Condition="'$(HasTestAssetProfile)' == 'true'">false</BuildProjectReferences> + </PropertyGroup> + </Target> + + <Target Name="PrepareForTestAssetPublish" BeforeTargets="PrepareForPublish" Condition="'@(TestAssetPublishProfile->Count())' != '0'"> + <PropertyGroup Condition="'$(HasTestAssetProfile)' == 'true'"> + <PublishDir>$(OutputPath)$(PublishDirName)\$(TestAssetOutputName)-$(TestAssetProfile)\</PublishDir> + </PropertyGroup> + + <PropertyGroup Condition="'$(HasTestAssetProfile)' != 'true'"> + <IsPublishable>false</IsPublishable> + <IsTransformWebConfigDisabled>true</IsTransformWebConfigDisabled> + </PropertyGroup> + </Target> + + <Target Name="PublishTestsAssets" AfterTargets="Build;Publish" Condition="'$(TestAssetProfile)' == '' AND '@(TestAssetPublishProfile->Count())' != '0'"> <!-- _InsidePublishTestsAssets is to avoid invoking this target recursively @@ -87,6 +97,6 @@ <MSBuild Projects="$(MSBuildProjectFullPath)" Targets="Publish" RemoveProperties="Platform;PlatformTarget" - Properties="ReferenceTestTasks=false;_InsidePublishTestsAssets=True;PublishDir=$(PublishDir)%(TestAssetPublishProfile.Identity)/;%(TestAssetPublishProfile.Properties)" /> + Properties="TestAssetProfile=%(TestAssetPublishProfile.Identity);ReferenceTestTasks=false;%(TestAssetPublishProfile.Properties)" /> </Target> </Project> -- GitLab