Usability cleanup in IIS tests (#10460)

This commit is contained in:
Justin Kotalik 2019-05-28 14:28:33 -07:00 committed by GitHub
parent 3eca32965d
commit 6e253996d9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
105 changed files with 354 additions and 835 deletions

View File

@ -28,12 +28,6 @@
<ProjectReference Include="..\..\test\testassets\InProcessWebSite\InProcessWebSite.csproj">
<ReferenceOutputAssembly>False</ReferenceOutputAssembly>
</ProjectReference>
<ProjectReference Include="..\..\test\testassets\OutOfProcessWebSite\OutOfProcessWebSite.csproj">
<ReferenceOutputAssembly>False</ReferenceOutputAssembly>
</ProjectReference>
<ProjectReference Include="..\..\test\testassets\StressTestWebSite\StressTestWebSite.csproj">
<ReferenceOutputAssembly>False</ReferenceOutputAssembly>
</ProjectReference>
<ProjectReference Include="$(RepoRoot)src\Hosting\Server.IntegrationTesting\src\Microsoft.AspNetCore.Server.IntegrationTesting.csproj" />
</ItemGroup>

View File

@ -8,7 +8,7 @@ using System.Threading.Tasks;
using BenchmarkDotNet.Attributes;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests;
using Microsoft.AspNetCore.Server.IIS.FunctionalTests;
using Microsoft.Extensions.Logging;
namespace Microsoft.AspNetCore.Server.IIS.Performance

View File

@ -8,7 +8,7 @@ using System.Net.Http;
using System.Net.Sockets;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Server.IIS.FunctionalTests.Utilities;
using Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests;
using Microsoft.AspNetCore.Server.IIS.FunctionalTests;
using Microsoft.AspNetCore.Server.IntegrationTesting;
using Microsoft.AspNetCore.Testing;
using Microsoft.AspNetCore.Testing.xunit;

View File

@ -12,7 +12,7 @@ using Microsoft.AspNetCore.Server.IntegrationTesting.IIS;
using Microsoft.AspNetCore.Testing.xunit;
using Xunit;
namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
namespace Microsoft.AspNetCore.Server.IIS.FunctionalTests
{
[Collection(PublishedSitesCollection.Name)]
public class BasicAuthTests : IISFunctionalTestBase

View File

@ -6,7 +6,7 @@ using System.Security.Cryptography;
using System.Security.Cryptography.X509Certificates;
using Xunit;
namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
namespace Microsoft.AspNetCore.Server.IIS.FunctionalTests
{
public class ClientCertificateFixture : IDisposable
{

View File

@ -6,7 +6,7 @@ using System.Net.Http;
using System.Security.Cryptography.X509Certificates;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Server.IIS.FunctionalTests.Utilities;
using Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests;
using Microsoft.AspNetCore.Server.IIS.FunctionalTests;
using Microsoft.AspNetCore.Server.IntegrationTesting;
using Microsoft.AspNetCore.Server.IntegrationTesting.Common;
using Microsoft.AspNetCore.Server.IntegrationTesting.IIS;

View File

@ -9,7 +9,7 @@ using Microsoft.AspNetCore.Server.IntegrationTesting;
using Microsoft.AspNetCore.Testing.xunit;
using Xunit;
namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
namespace Microsoft.AspNetCore.Server.IIS.FunctionalTests
{
[Collection(PublishedSitesCollection.Name)]
public class ClientDisconnectStressTests: FunctionalTestsBase

View File

@ -8,7 +8,7 @@ using Microsoft.AspNetCore.Server.IntegrationTesting;
using Microsoft.AspNetCore.Testing.xunit;
using Xunit;
namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
namespace Microsoft.AspNetCore.Server.IIS.FunctionalTests
{
[Collection(PublishedSitesCollection.Name)]
public class CommonStartupTests : IISFunctionalTestBase

View File

@ -10,7 +10,7 @@ using Microsoft.AspNetCore.Server.IntegrationTesting;
using Microsoft.AspNetCore.Testing.xunit;
using Xunit;
namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
namespace Microsoft.AspNetCore.Server.IIS.FunctionalTests
{
[Collection(PublishedSitesCollection.Name)]
public class CompressionTests : IISFunctionalTestBase

View File

@ -15,7 +15,7 @@ using Microsoft.AspNetCore.Testing.xunit;
using Microsoft.Extensions.Logging;
using Xunit;
namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
namespace Microsoft.AspNetCore.Server.IIS.FunctionalTests
{
[Collection(PublishedSitesCollection.Name)]
public class ConfigurationChangeTests : IISFunctionalTestBase
@ -72,11 +72,9 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
.SetAttributeValue("hostingModel", "inprocess"));
// Have to retry here to allow ANCM to receive notification and react to it
// Verify that inprocess application was created and tried to start
await deploymentResult.HttpClient.RetryRequestAsync("/HelloWorld", r => r.StatusCode == HttpStatusCode.InternalServerError);
StopServer();
EventLogHelpers.VerifyEventLogEvent(deploymentResult, EventLogHelpers.CouldNotFindHandler(), Logger);
// Verify that inprocess application was created and started, checking the server
// header to see that it is running inprocess
await deploymentResult.HttpClient.RetryRequestAsync("/HelloWorld", r => r.Headers.Server.ToString().StartsWith("Microsoft"));
}
[ConditionalTheory]

View File

@ -5,7 +5,7 @@ using System.Reflection;
using Microsoft.Extensions.Logging.Testing;
using Xunit.Abstractions;
namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
namespace Microsoft.AspNetCore.Server.IIS.FunctionalTests
{
public class FixtureLoggedTest: LoggedTest
{

View File

@ -14,7 +14,7 @@ using Microsoft.AspNetCore.Server.IntegrationTesting.IIS;
using Microsoft.AspNetCore.Testing.xunit;
using Xunit;
namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
namespace Microsoft.AspNetCore.Server.IIS.FunctionalTests
{
[Collection(PublishedSitesCollection.Name)]
public class HttpsTests : IISFunctionalTestBase

View File

@ -9,7 +9,7 @@ using Microsoft.AspNetCore.Testing.xunit;
using Microsoft.Extensions.Logging;
using Xunit;
namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
namespace Microsoft.AspNetCore.Server.IIS.FunctionalTests.InProcess
{
[Collection(IISTestSiteCollection.Name)]
public class ClientDisconnectTests: FixtureLoggedTest

View File

@ -10,7 +10,7 @@ using System.Threading.Tasks;
using Microsoft.AspNetCore.Testing.xunit;
using Xunit;
namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
namespace Microsoft.AspNetCore.Server.IIS.FunctionalTests.InProcess
{
[Collection(IISCompressionSiteCollection.Name)]
public class CompressionModuleTests : FixtureLoggedTest

View File

@ -7,7 +7,7 @@ using Microsoft.AspNetCore.Server.IntegrationTesting;
using Microsoft.AspNetCore.Testing.xunit;
using Xunit;
namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
namespace Microsoft.AspNetCore.Server.IIS.FunctionalTests.InProcess
{
[Collection(PublishedSitesCollection.Name)]

View File

@ -10,7 +10,7 @@ using Microsoft.AspNetCore.Server.IntegrationTesting.IIS;
using Microsoft.AspNetCore.Testing.xunit;
using Xunit;
namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
namespace Microsoft.AspNetCore.Server.IIS.FunctionalTests.InProcess
{
[Collection(PublishedSitesCollection.Name)]
public class ErrorPagesTests : IISFunctionalTestBase

View File

@ -6,7 +6,7 @@ using Microsoft.AspNetCore.Server.IIS.FunctionalTests.Utilities;
using Microsoft.AspNetCore.Testing.xunit;
using Xunit;
namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
namespace Microsoft.AspNetCore.Server.IIS.FunctionalTests.InProcess
{
[Collection(PublishedSitesCollection.Name)]
public class EventLogTests : IISFunctionalTestBase

View File

@ -6,7 +6,7 @@ using System.Threading.Tasks;
using Microsoft.AspNetCore.Testing.xunit;
using Xunit;
namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
namespace Microsoft.AspNetCore.Server.IIS.FunctionalTests.InProcess
{
[Collection(IISTestSiteCollection.Name)]
public class FeatureCollectionTest

View File

@ -14,7 +14,7 @@ using Microsoft.AspNetCore.Testing.xunit;
using Microsoft.Extensions.Logging;
using Xunit;
namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
namespace Microsoft.AspNetCore.Server.IIS.FunctionalTests.InProcess
{
[Collection(PublishedSitesCollection.Name)]
public class FrebTests : LogFileTestBase

View File

@ -5,7 +5,7 @@ using System.Threading.Tasks;
using Microsoft.AspNetCore.Testing.xunit;
using Xunit;
namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
namespace Microsoft.AspNetCore.Server.IIS.FunctionalTests.InProcess
{
[Collection(IISTestSiteCollection.Name)]
public class HelloWorldInProcessTests: FixtureLoggedTest

View File

@ -7,7 +7,7 @@ using System.Threading.Tasks;
using Microsoft.AspNetCore.Testing.xunit;
using Xunit;
namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
namespace Microsoft.AspNetCore.Server.IIS.FunctionalTests.InProcess
{
[Collection(IISTestSiteCollection.Name)]
public class HostingEnvironmentTests: FixtureLoggedTest

View File

@ -6,7 +6,7 @@ using System.Threading.Tasks;
using Microsoft.AspNetCore.Testing.xunit;
using Xunit;
namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
namespace Microsoft.AspNetCore.Server.IIS.FunctionalTests.InProcess
{
[Collection(IISTestSiteCollection.Name)]
public class InvalidReadWriteOperationTests

View File

@ -5,7 +5,7 @@ using System.Threading.Tasks;
using Microsoft.AspNetCore.Testing.xunit;
using Xunit;
namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
namespace Microsoft.AspNetCore.Server.IIS.FunctionalTests.InProcess
{
[Collection(IISTestSiteCollection.Name)]
public class LargeResponseBodyTests

View File

@ -9,7 +9,7 @@ using Microsoft.AspNetCore.Server.IntegrationTesting.IIS;
using Microsoft.AspNetCore.Testing.xunit;
using Xunit;
namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
namespace Microsoft.AspNetCore.Server.IIS.FunctionalTests.InProcess
{
[Collection(PublishedSitesCollection.Name)]
public class LogPipeTests : IISFunctionalTestBase

View File

@ -11,7 +11,7 @@ using Microsoft.AspNetCore.Server.IntegrationTesting.IIS;
using Microsoft.AspNetCore.Testing.xunit;
using Xunit;
namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
namespace Microsoft.AspNetCore.Server.IIS.FunctionalTests.InProcess
{
[Collection(PublishedSitesCollection.Name)]
public class MaxRequestBodySizeTests : IISFunctionalTestBase

View File

@ -10,7 +10,7 @@ using Microsoft.AspNetCore.Testing.xunit;
using Microsoft.Net.Http.Headers;
using Xunit;
namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
namespace Microsoft.AspNetCore.Server.IIS.FunctionalTests.InProcess
{
[Collection(IISTestSiteCollection.Name)]
public class ResponseHeaders

View File

@ -6,7 +6,7 @@ using Microsoft.AspNetCore.Server.IntegrationTesting;
using Microsoft.AspNetCore.Testing.xunit;
using Xunit;
namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
namespace Microsoft.AspNetCore.Server.IIS.FunctionalTests.InProcess
{
[Collection(IISTestSiteCollection.Name)]
public class ResponseInvalidOrderingTest

View File

@ -8,7 +8,7 @@ using Microsoft.AspNetCore.Server.IntegrationTesting;
using Microsoft.AspNetCore.Testing.xunit;
using Xunit;
namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
namespace Microsoft.AspNetCore.Server.IIS.FunctionalTests.InProcess
{
[Collection(IISTestSiteCollection.Name)]
public class ServerVariablesTest

View File

@ -9,7 +9,7 @@ using Microsoft.AspNetCore.Server.IntegrationTesting.IIS;
using Microsoft.AspNetCore.Testing.xunit;
using Xunit;
namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
namespace Microsoft.AspNetCore.Server.IIS.FunctionalTests.InProcess
{
[Collection(PublishedSitesCollection.Name)]
public class ShutdownTests : IISFunctionalTestBase

View File

@ -8,7 +8,7 @@ using Microsoft.AspNetCore.Server.IntegrationTesting.IIS;
using Microsoft.AspNetCore.Testing.xunit;
using Xunit;
namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
namespace Microsoft.AspNetCore.Server.IIS.FunctionalTests.InProcess
{
[Collection(PublishedSitesCollection.Name)]
public class StartupExceptionTests : LogFileTestBase

View File

@ -20,7 +20,7 @@ using Microsoft.AspNetCore.Testing.xunit;
using Microsoft.Win32;
using Xunit;
namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
namespace Microsoft.AspNetCore.Server.IIS.FunctionalTests.InProcess
{
[Collection(PublishedSitesCollection.Name)]
public class StartupTests : IISFunctionalTestBase

View File

@ -9,7 +9,7 @@ using System.Threading.Tasks;
using Microsoft.AspNetCore.Testing.xunit;
using Xunit;
namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
namespace Microsoft.AspNetCore.Server.IIS.FunctionalTests.InProcess
{
[Collection(IISTestSiteCollection.Name)]
public class SynchronousReadAndWriteTests: FixtureLoggedTest

View File

@ -11,7 +11,7 @@ using Microsoft.AspNetCore.Testing;
using Microsoft.AspNetCore.Testing.xunit;
using Xunit;
namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
namespace Microsoft.AspNetCore.Server.IIS.FunctionalTests
{
[Collection(PublishedSitesCollection.Name)]
public class LoggingTests : LogFileTestBase
@ -224,7 +224,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
public async Task CaptureLogsForOutOfProcessWhenProcessFailsToStart()
{
var deploymentParameters = Fixture.GetBaseDeploymentParameters(HostingModel.OutOfProcess);
deploymentParameters.TransformArguments((a, _) => $"{a} ConsoleWrite");
deploymentParameters.TransformArguments((a, _) => $"{a} ConsoleWriteSingle");
var deploymentResult = await DeployAsync(deploymentParameters);
var response = await deploymentResult.HttpClient.GetAsync("Test");

View File

@ -12,7 +12,7 @@ using Microsoft.AspNetCore.Server.IntegrationTesting.IIS;
using Microsoft.AspNetCore.Testing.xunit;
using Xunit;
namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
namespace Microsoft.AspNetCore.Server.IIS.FunctionalTests
{
[Collection(PublishedSitesCollection.Name)]
public class MultiApplicationTests : IISFunctionalTestBase

View File

@ -12,7 +12,7 @@ using Microsoft.AspNetCore.Server.IIS.FunctionalTests.Utilities;
using Microsoft.AspNetCore.Server.IntegrationTesting;
using Microsoft.AspNetCore.Testing.xunit;
namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
namespace Microsoft.AspNetCore.Server.IIS.FunctionalTests.OutOfProcess
{
[Collection(PublishedSitesCollection.Name)]
public class AspNetCorePortTests : IISFunctionalTestBase

View File

@ -13,7 +13,7 @@ using Microsoft.AspNetCore.Server.IntegrationTesting.IIS;
using Microsoft.AspNetCore.Testing.xunit;
using Xunit;
namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
namespace Microsoft.AspNetCore.Server.IIS.FunctionalTests.OutOfProcess
{
[Collection(PublishedSitesCollection.Name)]
public class GlobalVersionTests : IISFunctionalTestBase
@ -241,7 +241,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
foreach (FileInfo fileInfo in source.GetFiles())
{
var destFileName = Path.Combine(target.FullName, fileInfo.Name);
fileInfo.CopyTo(destFileName);
fileInfo.CopyTo(destFileName, overwrite: true);
}
}

View File

@ -12,7 +12,7 @@ using Microsoft.AspNetCore.Server.IntegrationTesting.IIS;
using Microsoft.AspNetCore.Testing.xunit;
using Xunit;
namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
namespace Microsoft.AspNetCore.Server.IIS.FunctionalTests.OutOfProcess
{
[Collection(PublishedSitesCollection.Name)]
public class HelloWorldTests : IISFunctionalTestBase
@ -66,7 +66,8 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
Assert.Equal("null", responseText);
Assert.Equal(deploymentResult.ContentRoot, await deploymentResult.HttpClient.GetStringAsync("/ContentRootPath"));
// Trailing slash
Assert.StartsWith(deploymentResult.ContentRoot, await deploymentResult.HttpClient.GetStringAsync("/ContentRootPath"));
Assert.Equal(deploymentResult.ContentRoot + "\\wwwroot", await deploymentResult.HttpClient.GetStringAsync("/WebRootPath"));
var expectedDll = "aspnetcorev2.dll";
Assert.Contains(deploymentResult.HostProcess.Modules.OfType<ProcessModule>(), m => m.FileName.Contains(expectedDll));

View File

@ -9,7 +9,7 @@ using Microsoft.AspNetCore.Server.IntegrationTesting;
using Microsoft.AspNetCore.Testing;
using Microsoft.Extensions.Logging;
namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
namespace Microsoft.AspNetCore.Server.IIS.FunctionalTests
{
public class PublishedApplicationPublisher: ApplicationPublisher
{

View File

@ -6,7 +6,7 @@ using Microsoft.AspNetCore.Server.IntegrationTesting;
using Microsoft.AspNetCore.Server.IntegrationTesting.IIS;
using Xunit;
namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
namespace Microsoft.AspNetCore.Server.IIS.FunctionalTests
{
/// <summary>
/// This type just maps collection names to available fixtures
@ -20,7 +20,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
public class PublishedSitesFixture : IDisposable
{
public PublishedApplicationPublisher InProcessTestSite { get; } = new PublishedApplicationPublisher(Helpers.GetInProcessTestSitesName());
public PublishedApplicationPublisher OutOfProcessTestSite { get; } = new PublishedApplicationPublisher(Helpers.GetOutOfProcessTestSitesName());
public PublishedApplicationPublisher OutOfProcessTestSite { get; } = new PublishedApplicationPublisher(Helpers.GetInProcessTestSitesName());
public void Dispose()
{

View File

@ -4,7 +4,7 @@
using System;
using Microsoft.AspNetCore.Testing.xunit;
namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
namespace Microsoft.AspNetCore.Server.IIS.FunctionalTests
{
[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Class | AttributeTargets.Method)]
public sealed class RequiresNewHandlerAttribute : Attribute, ITestCondition

View File

@ -4,7 +4,7 @@
using System;
using Microsoft.AspNetCore.Testing.xunit;
namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
namespace Microsoft.AspNetCore.Server.IIS.FunctionalTests
{
[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Class | AttributeTargets.Method)]
public sealed class RequiresNewShimAttribute : Attribute, ITestCondition

View File

@ -9,7 +9,7 @@ using Microsoft.AspNetCore.Server.IntegrationTesting;
using Microsoft.AspNetCore.Testing.xunit;
using Xunit;
namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
namespace Microsoft.AspNetCore.Server.IIS.FunctionalTests
{
[Collection(PublishedSitesCollection.Name)]
public class ServerAbortOutOfProcessTests : IISFunctionalTestBase

View File

@ -5,7 +5,7 @@ using System;
using System.Security.Principal;
using Microsoft.AspNetCore.Testing.xunit;
namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
namespace Microsoft.AspNetCore.Server.IIS.FunctionalTests
{
[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Class | AttributeTargets.Method)]
public sealed class SkipIfNotAdminAttribute : Attribute, ITestCondition

View File

@ -5,7 +5,7 @@ using System;
using Microsoft.AspNetCore.Server.IntegrationTesting;
using Microsoft.AspNetCore.Testing.xunit;
namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
namespace Microsoft.AspNetCore.Server.IIS.FunctionalTests
{
[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Class | AttributeTargets.Method)]
public sealed class SkipInVSTSAttribute : Attribute, ITestCondition

View File

@ -11,7 +11,7 @@ using Microsoft.AspNetCore.Server.IntegrationTesting.IIS;
using Microsoft.Extensions.Logging;
using Xunit;
namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
namespace Microsoft.AspNetCore.Server.IIS.FunctionalTests
{
public class EventLogHelpers
{

View File

@ -4,7 +4,7 @@
using System;
using System.IO;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests;
using Microsoft.AspNetCore.Server.IIS.FunctionalTests;
using Microsoft.AspNetCore.Server.IntegrationTesting.IIS;
using Microsoft.Extensions.Logging.Testing;
using Xunit.Abstractions;

View File

@ -16,7 +16,7 @@ using Microsoft.Extensions.Logging;
using Newtonsoft.Json;
using Xunit;
namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
namespace Microsoft.AspNetCore.Server.IIS.FunctionalTests
{
public static class Helpers
{
@ -28,8 +28,6 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
return DeployerSelector.IsForwardsCompatibilityTest ? "InProcessForwardsCompatWebSite" : "InProcessWebSite";
}
public static string GetOutOfProcessTestSitesName() => "OutOfProcessWebSite";
public static async Task AssertStarts(this IISDeploymentResult deploymentResult, string path = "/HelloWorld")
{
var response = await deploymentResult.HttpClient.GetAsync(path);

View File

@ -3,7 +3,7 @@
using System;
namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
namespace Microsoft.AspNetCore.Server.IIS.FunctionalTests
{
[Flags]
public enum IISCapability

View File

@ -3,7 +3,7 @@
using Xunit;
namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
namespace Microsoft.AspNetCore.Server.IIS.FunctionalTests
{
[CollectionDefinition(Name)]
public class IISCompressionSiteCollection : ICollectionFixture<IISCompressionSiteFixture>

View File

@ -10,7 +10,7 @@ using Microsoft.AspNetCore.Server.IntegrationTesting.IIS;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Testing;
namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
namespace Microsoft.AspNetCore.Server.IIS.FunctionalTests
{
public class IISCompressionSiteFixture : IISTestSiteFixture
{

View File

@ -5,7 +5,7 @@ using System;
using System.IO;
using System.Net;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests;
using Microsoft.AspNetCore.Server.IIS.FunctionalTests;
using Microsoft.AspNetCore.Server.IntegrationTesting;
using Microsoft.AspNetCore.Server.IntegrationTesting.IIS;
using Microsoft.Extensions.Logging;

View File

@ -3,7 +3,7 @@
using Xunit;
namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
namespace Microsoft.AspNetCore.Server.IIS.FunctionalTests
{
/// <summary>
/// This type just maps collection names to available fixtures

View File

@ -9,7 +9,7 @@ using Microsoft.AspNetCore.Server.IntegrationTesting.IIS;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Testing;
namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
namespace Microsoft.AspNetCore.Server.IIS.FunctionalTests
{
public class IISTestSiteFixture : IDisposable
{

View File

@ -3,7 +3,7 @@
using System;
using System.IO;
using Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests;
using Microsoft.AspNetCore.Server.IIS.FunctionalTests;
using Microsoft.AspNetCore.Server.IntegrationTesting.IIS;
using Xunit.Abstractions;

View File

@ -5,7 +5,7 @@ using System;
using Microsoft.AspNetCore.Server.IntegrationTesting;
using Microsoft.AspNetCore.Testing.xunit;
namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
namespace Microsoft.AspNetCore.Server.IIS.FunctionalTests
{
[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Class | AttributeTargets.Method)]
public sealed class RequiresEnvironmentVariableAttribute : Attribute, ITestCondition

View File

@ -5,7 +5,7 @@ using System;
using Microsoft.AspNetCore.Server.IntegrationTesting;
using Microsoft.AspNetCore.Testing.xunit;
namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
namespace Microsoft.AspNetCore.Server.IIS.FunctionalTests
{
[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Class | AttributeTargets.Method)]
public sealed class SkipIfDebugAttribute : Attribute, ITestCondition

View File

@ -10,7 +10,7 @@ using Microsoft.AspNetCore.Server.IntegrationTesting.IIS;
using Microsoft.AspNetCore.Testing.xunit;
using Xunit;
namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
namespace Microsoft.AspNetCore.Server.IIS.FunctionalTests
{
[Collection(PublishedSitesCollection.Name)]
public class WindowsAuthTests : IISFunctionalTestBase

View File

@ -7,7 +7,7 @@ using Microsoft.AspNetCore.Testing.xunit;
using Xunit;
using Xunit.Sdk;
namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
namespace Microsoft.AspNetCore.Server.IIS.FunctionalTests
{
[Collection(IISTestSiteCollection.Name)]
public class BackwardsCompatibilityTests : FixtureLoggedTest

View File

@ -3,7 +3,7 @@
using Microsoft.AspNetCore.Server.IntegrationTesting;
namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
namespace Microsoft.AspNetCore.Server.IIS.FunctionalTests
{
public static class DeployerSelector
{

View File

@ -22,9 +22,6 @@
<ProjectReference Include="..\testassets\InProcessWebSite\InProcessWebSite.csproj">
<ReferenceOutputAssembly>False</ReferenceOutputAssembly>
</ProjectReference>
<ProjectReference Include="..\testassets\OutOfProcessWebSite\OutOfProcessWebSite.csproj">
<ReferenceOutputAssembly>False</ReferenceOutputAssembly>
</ProjectReference>
</ItemGroup>
<ItemGroup>

View File

@ -3,7 +3,7 @@
using Microsoft.AspNetCore.Server.IntegrationTesting;
namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
namespace Microsoft.AspNetCore.Server.IIS.FunctionalTests
{
public static class DeployerSelector
{

View File

@ -7,7 +7,7 @@ using Microsoft.AspNetCore.Testing.xunit;
using Xunit;
using Xunit.Sdk;
namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
namespace Microsoft.AspNetCore.Server.IIS.FunctionalTests
{
[Collection(IISTestSiteCollection.Name)]
public class ForwardsCompatibilityTests : FixtureLoggedTest

View File

@ -16,9 +16,6 @@
<ProjectReference Include="..\testassets\InProcessForwardsCompatWebSite\InProcessForwardsCompatWebSite.csproj">
<ReferenceOutputAssembly>False</ReferenceOutputAssembly>
</ProjectReference>
<ProjectReference Include="..\testassets\OutOfProcessWebSite\OutOfProcessWebSite.csproj">
<ReferenceOutputAssembly>False</ReferenceOutputAssembly>
</ProjectReference>
</ItemGroup>
<ItemGroup>

View File

@ -3,7 +3,7 @@
using Microsoft.AspNetCore.Server.IntegrationTesting;
namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
namespace Microsoft.AspNetCore.Server.IIS.FunctionalTests
{
public static class DeployerSelector
{

View File

@ -18,9 +18,6 @@
<ProjectReference Include="..\testassets\InProcessWebSite\InProcessWebSite.csproj">
<ReferenceOutputAssembly>False</ReferenceOutputAssembly>
</ProjectReference>
<ProjectReference Include="..\testassets\OutOfProcessWebSite\OutOfProcessWebSite.csproj">
<ReferenceOutputAssembly>False</ReferenceOutputAssembly>
</ProjectReference>
</ItemGroup>
<ItemGroup>

View File

@ -7,14 +7,14 @@ using System.ServiceProcess;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Server.IIS.FunctionalTests.Utilities;
using Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests;
using Microsoft.AspNetCore.Server.IIS.FunctionalTests;
using Microsoft.AspNetCore.Server.IntegrationTesting;
using Microsoft.AspNetCore.Server.IntegrationTesting.IIS;
using Microsoft.AspNetCore.Testing;
using Microsoft.AspNetCore.Testing.xunit;
using Xunit;
namespace IIS.FunctionalTests
namespace Microsoft.AspNetCore.Server.IIS.FunctionalTests
{
[Collection(PublishedSitesCollection.Name)]
public class ApplicationInitializationTests : IISFunctionalTestBase

View File

@ -1,18 +1,15 @@
// 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.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Server.IIS.FunctionalTests.Utilities;
using Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests;
using Microsoft.AspNetCore.Server.IntegrationTesting.IIS;
using Microsoft.AspNetCore.Testing.xunit;
using Newtonsoft.Json;
using Xunit;
namespace IIS.FunctionalTests.Inprocess
namespace Microsoft.AspNetCore.Server.IIS.FunctionalTests
{
[Collection(PublishedSitesCollection.Name)]
public class StdOutRedirectionTests : LogFileTestBase

View File

@ -1,31 +0,0 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Diagnostics;
using System.IO;
using Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests;
using Microsoft.AspNetCore.Testing;
using Microsoft.AspNetCore.Testing.xunit;
using Xunit;
namespace IIS.FunctionalTests
{
public class MofFileTests
{
[ConditionalFact]
[OSSkipCondition(OperatingSystems.Linux | OperatingSystems.MacOSX)]
[RequiresIIS(IISCapability.TracingModule)]
[SkipOnHelix("https://github.com/aspnet/AspNetCore-Internal/issues/2222")]
public void CheckMofFile()
{
// This test code needs to be updated to support distributed testing.
// See https://github.com/aspnet/AspNetCore-Internal/issues/2222
#pragma warning disable 0618
var path = Path.Combine(TestPathUtilities.GetSolutionRootDirectory("IISIntegration"), "aspnetcoremodulev2", "aspnetcore", "ancm.mof");
#pragma warning restore 0618
var process = Process.Start("mofcomp.exe", path);
process.WaitForExit();
Assert.Equal(0, process.ExitCode);
}
}
}

View File

@ -1,7 +1,7 @@
// 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.IISIntegration.FunctionalTests;
using Microsoft.AspNetCore.Server.IIS.FunctionalTests;
using Microsoft.Extensions.Logging.Testing;
using Xunit;

View File

@ -10,7 +10,7 @@ using System.Xml.Linq;
using Microsoft.AspNetCore.Testing.xunit;
using Microsoft.Win32;
namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
namespace Microsoft.AspNetCore.Server.IIS.FunctionalTests
{
[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Class | AttributeTargets.Method)]
public sealed class RequiresIISAttribute : Attribute, ITestCondition

View File

@ -13,7 +13,7 @@ using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Testing;
using Xunit;
namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
namespace Microsoft.AspNetCore.Server.IIS.FunctionalTests
{
[SkipIfHostableWebCoreNotAvailable]
[OSSkipCondition(OperatingSystems.Windows, WindowsVersions.Win7, "https://github.com/aspnet/IISIntegration/issues/866")]

View File

@ -6,7 +6,7 @@ using Microsoft.AspNetCore.Http.Features;
using Microsoft.AspNetCore.Testing.xunit;
using Xunit;
namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
namespace Microsoft.AspNetCore.Server.IIS.FunctionalTests
{
[SkipIfHostableWebCoreNotAvailable]
[OSSkipCondition(OperatingSystems.Windows, WindowsVersions.Win7, "https://github.com/aspnet/IISIntegration/issues/866")]

View File

@ -7,7 +7,7 @@ using Microsoft.AspNetCore.Http.Features;
using Microsoft.AspNetCore.Testing.xunit;
using Xunit;
namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
namespace Microsoft.AspNetCore.Server.IIS.FunctionalTests
{
[SkipIfHostableWebCoreNotAvailable]
[OSSkipCondition(OperatingSystems.Windows, WindowsVersions.Win7, "https://github.com/aspnet/IISIntegration/issues/866")]

View File

@ -6,7 +6,7 @@ using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Http.Features;
using Microsoft.AspNetCore.Server.IIS;
using Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests;
using Microsoft.AspNetCore.Server.IIS.FunctionalTests;
using Microsoft.AspNetCore.Testing.xunit;
using Microsoft.Extensions.Logging.Testing;
using Xunit;

View File

@ -9,7 +9,7 @@ using Microsoft.AspNetCore.Server.IntegrationTesting;
using Microsoft.AspNetCore.Testing.xunit;
using Xunit;
namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
namespace Microsoft.AspNetCore.Server.IIS.FunctionalTests
{
[SkipIfHostableWebCoreNotAvailable]
[OSSkipCondition(OperatingSystems.Windows, WindowsVersions.Win7, "https://github.com/aspnet/IISIntegration/issues/866")]

View File

@ -6,7 +6,7 @@ using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Testing;
using Xunit;
namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
namespace Microsoft.AspNetCore.Server.IIS.FunctionalTests
{
public class StrictTestServerTests: LoggedTest
{

View File

@ -7,7 +7,7 @@ using Microsoft.AspNetCore.Testing.xunit;
using Microsoft.Extensions.Logging.Testing;
using Xunit;
namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
namespace Microsoft.AspNetCore.Server.IIS.FunctionalTests
{
[SkipIfHostableWebCoreNotAvailable]
[OSSkipCondition(OperatingSystems.Windows, WindowsVersions.Win7, "https://github.com/aspnet/IISIntegration/issues/866")]

View File

@ -5,7 +5,7 @@ using System;
using System.IO;
using Microsoft.AspNetCore.Testing.xunit;
namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
namespace Microsoft.AspNetCore.Server.IIS.FunctionalTests
{
[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Class | AttributeTargets.Method)]
public sealed class SkipIfHostableWebCoreNotAvailableAttribute : Attribute, ITestCondition

View File

@ -21,7 +21,7 @@ using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
namespace Microsoft.AspNetCore.Server.IIS.FunctionalTests
{
public class TestServer: IDisposable, IStartup
{

View File

@ -3,7 +3,7 @@
using Microsoft.AspNetCore.Server.IntegrationTesting;
namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
namespace Microsoft.AspNetCore.Server.IIS.FunctionalTests
{
public static class DeployerSelector
{

View File

@ -19,9 +19,6 @@
<ProjectReference Include="..\testassets\InProcessWebSite\InProcessWebSite.csproj">
<ReferenceOutputAssembly>False</ReferenceOutputAssembly>
</ProjectReference>
<ProjectReference Include="..\testassets\OutOfProcessWebSite\OutOfProcessWebSite.csproj">
<ReferenceOutputAssembly>False</ReferenceOutputAssembly>
</ProjectReference>
</ItemGroup>
<ItemGroup>

View File

@ -3,12 +3,12 @@
using System.Threading.Tasks;
using Microsoft.AspNetCore.Server.IIS.FunctionalTests.Utilities;
using Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests;
using Microsoft.AspNetCore.Server.IIS.FunctionalTests;
using Microsoft.AspNetCore.Server.IntegrationTesting;
using Microsoft.AspNetCore.Testing.xunit;
using Xunit;
namespace IISExpress.FunctionalTests.Inprocess
namespace Microsoft.AspNetCore.Server.IIS.FunctionalTests.InProcess
{
[Collection(PublishedSitesCollection.Name)]
public class AppOfflineIISExpressTests : IISFunctionalTestBase

View File

@ -9,7 +9,7 @@ using Microsoft.AspNetCore.Server.IntegrationTesting.IIS;
using Microsoft.AspNetCore.Testing.xunit;
using Xunit;
namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
namespace Microsoft.AspNetCore.Server.IIS.FunctionalTests.InProcess
{
[Collection(PublishedSitesCollection.Name)]
public class AuthenticationTests : IISFunctionalTestBase

View File

@ -12,7 +12,7 @@ using Microsoft.AspNetCore.Server.IntegrationTesting.IIS;
using Microsoft.AspNetCore.Testing.xunit;
using Xunit;
namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
namespace Microsoft.AspNetCore.Server.IIS.FunctionalTests
{
[Collection(PublishedSitesCollection.Name)]
public class IISExpressShutdownTests : IISFunctionalTestBase

View File

@ -10,7 +10,7 @@ using System.Threading.Tasks;
using Microsoft.AspNetCore.Testing.xunit;
using Xunit;
namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
namespace Microsoft.AspNetCore.Server.IIS.FunctionalTests
{
[Collection(IISTestSiteCollection.Name)]
[OSSkipCondition(OperatingSystems.Windows, WindowsVersions.Win7, SkipReason = "No supported on this platform")]

View File

@ -11,7 +11,7 @@ using Microsoft.AspNetCore.Server.IntegrationTesting;
using Microsoft.AspNetCore.Testing.xunit;
using Xunit;
namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
namespace Microsoft.AspNetCore.Server.IIS.FunctionalTests
{
[Collection(PublishedSitesCollection.Name)]
public class MultipleAppTests : IISFunctionalTestBase

View File

@ -11,7 +11,7 @@ using Microsoft.AspNetCore.Testing.xunit;
using Xunit;
using Xunit.Abstractions;
namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
namespace Microsoft.AspNetCore.Server.IIS.FunctionalTests
{
[Collection(PublishedSitesCollection.Name)]
public class NtlmAuthenticationTests : IISFunctionalTestBase

View File

@ -1,7 +1,7 @@
// 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.IISIntegration.FunctionalTests;
using Microsoft.AspNetCore.Server.IIS.FunctionalTests;
using Microsoft.Extensions.Logging.Testing;
using Xunit;

View File

@ -5,7 +5,7 @@ using System;
using Microsoft.AspNetCore.Server.IntegrationTesting;
using Microsoft.AspNetCore.Testing.xunit;
namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
namespace Microsoft.AspNetCore.Server.IIS.FunctionalTests
{
[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Class | AttributeTargets.Method)]
public sealed class RequiresIISAttribute : Attribute, ITestCondition

View File

@ -10,7 +10,7 @@ using Microsoft.AspNetCore.Server.IntegrationTesting.IIS;
using Microsoft.AspNetCore.Testing.xunit;
using Xunit;
namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
namespace Microsoft.AspNetCore.Server.IIS.FunctionalTests
{
[Collection(PublishedSitesCollection.Name)]
public class UpgradeFeatureDetectionTests : IISFunctionalTestBase

View File

@ -12,20 +12,16 @@
<ItemGroup Condition="'$(OS)' == 'Windows_NT'">
<TestAssetPublishProfile Include="Portable" Properties="TargetFramework=netcoreapp3.0" />
<TestAssetPublishProfile Include="Standalone-x64" Properties="RuntimeIdentifier=win-x64;" />
<TestAssetPublishProfile Include="Standalone-x86" Properties="RuntimeIdentifier=win-x86;" />
</ItemGroup>
<ItemGroup>
<Compile Include="..\shared\**\*.cs" />
<Compile Include="..\InProcessWebSite\*.cs" />
<Compile Include="..\InProcessWebSite\Properties\*.cs" />
<None Include="..\InProcessWebSite\wwwroot\**" CopyToOutputDirectory="Always" LinkBase="wwwroot/"/>
<None Include="..\InProcessWebSite\web.config" CopyToOutputDirectory="Always" />
</ItemGroup>
<ItemGroup>
<None Include="wwwroot\**" CopyToOutputDirectory="Always" />
</ItemGroup>
<ItemGroup>
<!-- This package is hard-coded to the 2.2.0 package as a part of ensuring ANCM stays forward compatible. -->
<PackageReference Include="Microsoft.AspNetCore.Server.IIS" Version="2.2.0">
@ -34,8 +30,10 @@
</ItemGroup>
<ItemGroup>
<Reference Include="Microsoft.AspNetCore.ResponseCompression" />
<Reference Include="Microsoft.AspNetCore.Hosting" />
<Reference Include="Microsoft.AspNetCore.ResponseCompression" />
<Reference Include="Microsoft.AspNetCore.Server.IISIntegration" />
<Reference Include="Microsoft.AspNetCore.Server.Kestrel" />
<Reference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" />
<Reference Include="Microsoft.Extensions.Configuration.Json" />
<Reference Include="Microsoft.Extensions.Logging.Console" />

View File

@ -10,7 +10,6 @@
<ItemGroup Condition="'$(OS)' == 'Windows_NT'">
<TestAssetPublishProfile Include="Portable" Properties="TargetFramework=netcoreapp3.0" />
<TestAssetPublishProfile Include="Standalone-x64" Properties="RuntimeIdentifier=win-x64;" />
<TestAssetPublishProfile Include="Standalone-x86" Properties="RuntimeIdentifier=win-x86;" />
</ItemGroup>
<ItemGroup>
@ -22,6 +21,8 @@
<Reference Include="Microsoft.AspNetCore.Hosting" />
<Reference Include="Microsoft.AspNetCore.ResponseCompression" />
<Reference Include="Microsoft.AspNetCore.Server.IIS" />
<Reference Include="Microsoft.AspNetCore.Server.IISIntegration" />
<Reference Include="Microsoft.AspNetCore.Server.Kestrel" />
<Reference Include="Microsoft.AspNetCore.WebUtilities" />
<Reference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" />
<Reference Include="Microsoft.Extensions.Configuration.Json" />

View File

@ -85,6 +85,13 @@ namespace TestSite
Console.BackgroundColor = ConsoleColor.Blue;
Console.WriteLine("彡⾔");
break;
case "ConsoleWriteSingle":
Console.WriteLine("Wow!");
return 0;
case "ConsoleWrite30Kb":
// Write over 30kb to make sure logs are truncated.
Console.WriteLine(new string('a', 40000));
return 0;
case "OverriddenServer":
{
var host = new WebHostBuilder()
@ -172,7 +179,9 @@ namespace TestSite
factory.AddConsole();
factory.AddFilter("Console", level => level >= LogLevel.Information);
})
.UseKestrel()
.UseIIS()
.UseIISIntegration()
.UseStartup<Startup>()
.Build();

View File

@ -2,9 +2,12 @@
// 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.Linq;
using System.Net;
using System.Runtime.InteropServices;
using System.Security.Principal;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
@ -12,10 +15,13 @@ using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Hosting.Server;
using Microsoft.AspNetCore.Hosting.Server.Features;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Http.Features;
using Microsoft.AspNetCore.IISIntegration.FunctionalTests;
using Microsoft.AspNetCore.Server.IIS;
using Microsoft.AspNetCore.Server.IISIntegration;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Primitives;
@ -29,6 +35,132 @@ namespace TestSite
{
TestStartup.Register(app, this);
}
public void ConfigureServices(IServiceCollection serviceCollection)
{
serviceCollection.AddResponseCompression();
}
private async Task ContentRootPath(HttpContext ctx) => await ctx.Response.WriteAsync(ctx.RequestServices.GetService<IWebHostEnvironment>().ContentRootPath);
private async Task WebRootPath(HttpContext ctx) => await ctx.Response.WriteAsync(ctx.RequestServices.GetService<IWebHostEnvironment>().WebRootPath);
private async Task CurrentDirectory(HttpContext ctx) => await ctx.Response.WriteAsync(Environment.CurrentDirectory);
private async Task BaseDirectory(HttpContext ctx) => await ctx.Response.WriteAsync(AppContext.BaseDirectory);
private async Task ASPNETCORE_IIS_PHYSICAL_PATH(HttpContext ctx) => await ctx.Response.WriteAsync(Environment.GetEnvironmentVariable("ASPNETCORE_IIS_PHYSICAL_PATH"));
private async Task ServerAddresses(HttpContext ctx)
{
var serverAddresses = ctx.RequestServices.GetService<IServer>().Features.Get<IServerAddressesFeature>();
await ctx.Response.WriteAsync(string.Join(",", serverAddresses.Addresses));
}
private async Task ConsoleWrite(HttpContext ctx)
{
Console.WriteLine("TEST MESSAGE");
await ctx.Response.WriteAsync("Hello World");
}
private async Task ConsoleErrorWrite(HttpContext ctx)
{
Console.Error.WriteLine("TEST MESSAGE");
await ctx.Response.WriteAsync("Hello World");
}
public async Task Auth(HttpContext ctx)
{
var authProvider = ctx.RequestServices.GetService<IAuthenticationSchemeProvider>();
var authScheme = (await authProvider.GetAllSchemesAsync()).SingleOrDefault();
await ctx.Response.WriteAsync(authScheme?.Name ?? "null");
if (ctx.User.Identity.Name != null)
{
await ctx.Response.WriteAsync(":" + ctx.User.Identity.Name);
}
}
public async Task GetClientCert(HttpContext context)
{
var clientCert = context.Connection.ClientCertificate;
await context.Response.WriteAsync(clientCert != null ? $"Enabled;{clientCert.GetCertHashString()}" : "Disabled");
}
private static int _waitingRequestCount;
public Task WaitForAbort(HttpContext context)
{
Interlocked.Increment(ref _waitingRequestCount);
try
{
context.RequestAborted.WaitHandle.WaitOne();
return Task.CompletedTask;
}
finally
{
Interlocked.Decrement(ref _waitingRequestCount);
}
}
public Task Abort(HttpContext context)
{
context.Abort();
return Task.CompletedTask;
}
public async Task WaitingRequestCount(HttpContext context)
{
await context.Response.WriteAsync(_waitingRequestCount.ToString());
}
public Task CreateFile(HttpContext context)
{
var hostingEnv = context.RequestServices.GetService<IWebHostEnvironment>();
if (context.Connection.LocalIpAddress == null || context.Connection.RemoteIpAddress == null)
{
throw new Exception("Failed to set local and remote ip addresses");
}
File.WriteAllText(System.IO.Path.Combine(hostingEnv.ContentRootPath, "Started.txt"), "");
return Task.CompletedTask;
}
public Task OverrideServer(HttpContext context)
{
context.Response.Headers["Server"] = "MyServer/7.8";
return Task.CompletedTask;
}
public void CompressedData(IApplicationBuilder builder)
{
builder.UseResponseCompression();
// write random bytes to check that compressed data is passed through
builder.Run(
async context =>
{
context.Response.ContentType = "text/html";
await context.Response.Body.WriteAsync(new byte[100], 0, 100);
});
}
[DllImport("kernel32.dll")]
static extern uint GetDllDirectory(uint nBufferLength, [Out] StringBuilder lpBuffer);
private async Task DllDirectory(HttpContext context)
{
var builder = new StringBuilder(1024);
GetDllDirectory(1024, builder);
await context.Response.WriteAsync(builder.ToString());
}
private async Task GetEnvironmentVariable(HttpContext ctx)
{
await ctx.Response.WriteAsync(Environment.GetEnvironmentVariable(ctx.Request.Query["name"].ToString()));
}
private async Task ServerVariable(HttpContext ctx)
{
@ -447,18 +579,6 @@ namespace TestSite
await ctx.Request.Body.CopyToAsync(ctx.Response.Body);
}
private async Task UpgradeFeatureDetection(HttpContext ctx)
{
if (ctx.Features.Get<IHttpUpgradeFeature>() != null)
{
await ctx.Response.WriteAsync("Enabled");
}
else
{
await ctx.Response.WriteAsync("Disabled");
}
}
private async Task TestReadOffsetWorks(HttpContext ctx)
{
var buffer = new byte[11];
@ -645,7 +765,7 @@ namespace TestSite
private async Task LargeResponseFile(HttpContext ctx)
{
var tempFile = Path.GetTempFileName();
var tempFile = System.IO.Path.GetTempFileName();
var fileContent = new string('a', 200000);
var fileStream = File.OpenWrite(tempFile);
@ -742,5 +862,73 @@ namespace TestSite
public Task HttpsHelloWorld(HttpContext ctx) =>
ctx.Response.WriteAsync("Scheme:" + ctx.Request.Scheme + "; Original:" + ctx.Request.Headers["x-original-proto"]);
public Task Path(HttpContext ctx) => ctx.Response.WriteAsync(ctx.Request.Path.Value);
public Task Query(HttpContext ctx) => ctx.Response.WriteAsync(ctx.Request.QueryString.Value);
public Task BodyLimit(HttpContext ctx) => ctx.Response.WriteAsync(ctx.Features.Get<IHttpMaxRequestBodySizeFeature>()?.MaxRequestBodySize?.ToString() ?? "null");
public Task Anonymous(HttpContext context) => context.Response.WriteAsync("Anonymous?" + !context.User.Identity.IsAuthenticated);
public Task Restricted(HttpContext context)
{
if (context.User.Identity.IsAuthenticated)
{
Assert.IsType<WindowsPrincipal>(context.User);
return context.Response.WriteAsync(context.User.Identity.AuthenticationType);
}
else
{
return context.ChallengeAsync(IISDefaults.AuthenticationScheme);
}
}
public Task Forbidden(HttpContext context) => context.ForbidAsync(IISDefaults.AuthenticationScheme);
public Task RestrictedNTLM(HttpContext context)
{
if (string.Equals("NTLM", context.User.Identity.AuthenticationType, StringComparison.Ordinal))
{
return context.Response.WriteAsync("NTLM");
}
else
{
return context.ChallengeAsync(IISDefaults.AuthenticationScheme);
}
}
public Task UpgradeFeatureDetection(HttpContext context) =>
context.Response.WriteAsync(context.Features.Get<IHttpUpgradeFeature>() != null? "Enabled": "Disabled");
public Task CheckRequestHandlerVersion(HttpContext context)
{
// We need to check if the aspnetcorev2_outofprocess dll is loaded by iisexpress.exe
// As they aren't in the same process, we will try to delete the file and expect a file
// in use error
try
{
File.Delete(context.Request.Headers["ANCMRHPath"]);
}
catch(UnauthorizedAccessException)
{
// TODO calling delete on the file will succeed when running with IIS
return context.Response.WriteAsync("Hello World");
}
return context.Response.WriteAsync(context.Request.Headers["ANCMRHPath"]);
}
private async Task ProcessId(HttpContext context)
{
await context.Response.WriteAsync(Process.GetCurrentProcess().Id.ToString());
}
public async Task HTTPS_PORT(HttpContext context)
{
var httpsPort = context.RequestServices.GetService<IConfiguration>().GetValue<int?>("HTTPS_PORT");
await context.Response.WriteAsync(httpsPort.HasValue ? httpsPort.Value.ToString() : "NOVALUE");
}
}
}

View File

@ -4,7 +4,7 @@
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath="%LAUNCHER_PATH%" arguments="%LAUNCHER_ARGS%" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" forwardWindowsAuthToken="false" hostingModel="inprocess">
<aspNetCore processPath="%LAUNCHER_PATH%" arguments="%LAUNCHER_ARGS%" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" forwardWindowsAuthToken="true" hostingModel="inprocess">
</aspNetCore>
</system.webServer>
</configuration>

View File

@ -1,35 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<Import Project="..\..\..\..\build\testsite.props" />
<PropertyGroup>
<TargetFramework>netcoreapp3.0</TargetFramework>
<AspNetCoreHostingModel>OutOfProcess</AspNetCoreHostingModel>
</PropertyGroup>
<ItemGroup Condition="'$(OS)' == 'Windows_NT'">
<TestAssetPublishProfile Include="Portable" Properties="UseAppHost=false;TargetFramework=netcoreapp3.0" />
<TestAssetPublishProfile Include="Standalone-x64" Properties="RuntimeIdentifier=win-x64;" />
<TestAssetPublishProfile Include="Standalone-x86" Properties="RuntimeIdentifier=win-x86;" />
</ItemGroup>
<ItemGroup>
<Compile Include="..\shared\**\*.cs" />
</ItemGroup>
<ItemGroup>
<None Include="wwwroot\**" CopyToOutputDirectory="Always" />
</ItemGroup>
<ItemGroup>
<Reference Include="Microsoft.AspNetCore.ResponseCompression" />
<Reference Include="Microsoft.AspNetCore.Server.IISIntegration" />
<Reference Include="Microsoft.AspNetCore.Server.Kestrel" />
<Reference Include="Microsoft.AspNetCore.WebUtilities" />
<Reference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" />
<Reference Include="Microsoft.Extensions.Configuration.Json" />
<Reference Include="Microsoft.Extensions.Logging.Console" />
<Reference Include="xunit.assert" />
</ItemGroup>
</Project>

View File

@ -1,55 +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 System.Diagnostics;
using System.IO;
using System.Linq;
using System.Threading;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Logging;
namespace TestSite
{
public static class Program
{
public static int Main(string[] args)
{
var mode = args.FirstOrDefault();
switch (mode)
{
case "CreateFile":
File.WriteAllText(args[1], "");
return StartServer();
case "ConsoleWrite":
Console.WriteLine("Wow!");
return 0;
case "ConsoleWrite30Kb":
// Write over 30kb to make sure logs are truncated.
Console.WriteLine(new string('a', 40000));
return 0;
}
return StartServer();
}
private static int StartServer()
{
var host = new WebHostBuilder()
.ConfigureLogging(
(_, factory) => {
factory.AddConsole();
factory.AddFilter("Console", level => level >= LogLevel.Information);
})
.UseContentRoot(Directory.GetCurrentDirectory())
.UseIISIntegration()
.UseStartup<Startup>()
.UseKestrel()
.Build();
host.Run();
return 0;
}
}
}

View File

@ -1,101 +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 System.Diagnostics;
using System.IO;
using System.Security.Principal;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Http.Features;
using Microsoft.AspNetCore.IISIntegration.FunctionalTests;
using Microsoft.AspNetCore.Server.IISIntegration;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Xunit;
namespace TestSite
{
public partial class Startup
{
public void Configure(IApplicationBuilder app)
{
TestStartup.Register(app, this);
}
public Task Path(HttpContext ctx) => ctx.Response.WriteAsync(ctx.Request.Path.Value);
public Task Query(HttpContext ctx) => ctx.Response.WriteAsync(ctx.Request.QueryString.Value);
public Task BodyLimit(HttpContext ctx) => ctx.Response.WriteAsync(ctx.Features.Get<IHttpMaxRequestBodySizeFeature>()?.MaxRequestBodySize?.ToString() ?? "null");
public Task HelloWorld(HttpContext ctx) => ctx.Response.WriteAsync("Hello World");
public Task HttpsHelloWorld(HttpContext ctx) =>
ctx.Response.WriteAsync("Scheme:" + ctx.Request.Scheme + "; Original:" + ctx.Request.Headers["x-original-proto"]);
public Task Anonymous(HttpContext context) => context.Response.WriteAsync("Anonymous?" + !context.User.Identity.IsAuthenticated);
public Task Restricted(HttpContext context)
{
if (context.User.Identity.IsAuthenticated)
{
Assert.IsType<WindowsPrincipal>(context.User);
return context.Response.WriteAsync(context.User.Identity.AuthenticationType);
}
else
{
return context.ChallengeAsync(IISDefaults.AuthenticationScheme);
}
}
public Task Forbidden(HttpContext context) => context.ForbidAsync(IISDefaults.AuthenticationScheme);
public Task RestrictedNTLM(HttpContext context)
{
if (string.Equals("NTLM", context.User.Identity.AuthenticationType, StringComparison.Ordinal))
{
return context.Response.WriteAsync("NTLM");
}
else
{
return context.ChallengeAsync(IISDefaults.AuthenticationScheme);
}
}
public Task UpgradeFeatureDetection(HttpContext context) =>
context.Response.WriteAsync(context.Features.Get<IHttpUpgradeFeature>() != null? "Enabled": "Disabled");
public Task CheckRequestHandlerVersion(HttpContext context)
{
// We need to check if the aspnetcorev2_outofprocess dll is loaded by iisexpress.exe
// As they aren't in the same process, we will try to delete the file and expect a file
// in use error
try
{
File.Delete(context.Request.Headers["ANCMRHPath"]);
}
catch(UnauthorizedAccessException)
{
// TODO calling delete on the file will succeed when running with IIS
return context.Response.WriteAsync("Hello World");
}
return context.Response.WriteAsync(context.Request.Headers["ANCMRHPath"]);
}
private async Task ProcessId(HttpContext context)
{
await context.Response.WriteAsync(Process.GetCurrentProcess().Id.ToString());
}
public async Task HTTPS_PORT(HttpContext context)
{
var httpsPort = context.RequestServices.GetService<IConfiguration>().GetValue<int?>("HTTPS_PORT");
await context.Response.WriteAsync(httpsPort.HasValue ? httpsPort.Value.ToString() : "NOVALUE");
}
}
}

View File

@ -1,26 +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 Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Logging;
namespace ANCMStressTestApp
{
public class Program
{
public static void Main(string[] args)
{
var host = new WebHostBuilder()
.ConfigureLogging((_, factory) =>
{
factory.AddConsole();
})
.UseKestrel()
.UseIISIntegration()
.UseStartup<Startup>()
.Build();
host.Run();
}
}
}

Some files were not shown because too many files have changed in this diff Show More