Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
90 changes: 90 additions & 0 deletions src/Servers/FunctionalTests.sln
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,18 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ServerComparison.TestSites"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Server.IIS", "IIS\IIS\src\Microsoft.AspNetCore.Server.IIS.csproj", "{5DAF9603-999A-4759-AEE4-5E0F4D6D9AF7}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Server.IntegrationTesting.IIS", "IIS\IntegrationTesting.IIS\src\Microsoft.AspNetCore.Server.IntegrationTesting.IIS.csproj", "{689572FA-D5BA-4C70-94EA-C7CD3C1F2815}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Authentication.Negotiate", "..\Security\Authentication\Negotiate\src\Microsoft.AspNetCore.Authentication.Negotiate.csproj", "{F3BAB460-05C9-417A-BFDF-4FE93055A915}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Authentication", "..\Security\Authentication\Core\src\Microsoft.AspNetCore.Authentication.csproj", "{0F15D893-B455-4D44-8F00-AFCA9D90C1BE}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.DataProtection", "..\DataProtection\DataProtection\src\Microsoft.AspNetCore.DataProtection.csproj", "{81827F08-E8C8-4366-8E0D-6F2C832371F1}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.DataProtection.Abstractions", "..\DataProtection\Abstractions\src\Microsoft.AspNetCore.DataProtection.Abstractions.csproj", "{AA9993DE-EE40-4884-AA5B-1A5AB630B123}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Cryptography.Internal", "..\DataProtection\Cryptography.Internal\src\Microsoft.AspNetCore.Cryptography.Internal.csproj", "{DB802A16-1630-4C3D-A366-EB96A2C5AEBC}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -153,6 +165,78 @@ Global
{5DAF9603-999A-4759-AEE4-5E0F4D6D9AF7}.Release|x64.Build.0 = Release|Any CPU
{5DAF9603-999A-4759-AEE4-5E0F4D6D9AF7}.Release|x86.ActiveCfg = Release|Any CPU
{5DAF9603-999A-4759-AEE4-5E0F4D6D9AF7}.Release|x86.Build.0 = Release|Any CPU
{689572FA-D5BA-4C70-94EA-C7CD3C1F2815}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{689572FA-D5BA-4C70-94EA-C7CD3C1F2815}.Debug|Any CPU.Build.0 = Debug|Any CPU
{689572FA-D5BA-4C70-94EA-C7CD3C1F2815}.Debug|x64.ActiveCfg = Debug|Any CPU
{689572FA-D5BA-4C70-94EA-C7CD3C1F2815}.Debug|x64.Build.0 = Debug|Any CPU
{689572FA-D5BA-4C70-94EA-C7CD3C1F2815}.Debug|x86.ActiveCfg = Debug|Any CPU
{689572FA-D5BA-4C70-94EA-C7CD3C1F2815}.Debug|x86.Build.0 = Debug|Any CPU
{689572FA-D5BA-4C70-94EA-C7CD3C1F2815}.Release|Any CPU.ActiveCfg = Release|Any CPU
{689572FA-D5BA-4C70-94EA-C7CD3C1F2815}.Release|Any CPU.Build.0 = Release|Any CPU
{689572FA-D5BA-4C70-94EA-C7CD3C1F2815}.Release|x64.ActiveCfg = Release|Any CPU
{689572FA-D5BA-4C70-94EA-C7CD3C1F2815}.Release|x64.Build.0 = Release|Any CPU
{689572FA-D5BA-4C70-94EA-C7CD3C1F2815}.Release|x86.ActiveCfg = Release|Any CPU
{689572FA-D5BA-4C70-94EA-C7CD3C1F2815}.Release|x86.Build.0 = Release|Any CPU
{F3BAB460-05C9-417A-BFDF-4FE93055A915}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F3BAB460-05C9-417A-BFDF-4FE93055A915}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F3BAB460-05C9-417A-BFDF-4FE93055A915}.Debug|x64.ActiveCfg = Debug|Any CPU
{F3BAB460-05C9-417A-BFDF-4FE93055A915}.Debug|x64.Build.0 = Debug|Any CPU
{F3BAB460-05C9-417A-BFDF-4FE93055A915}.Debug|x86.ActiveCfg = Debug|Any CPU
{F3BAB460-05C9-417A-BFDF-4FE93055A915}.Debug|x86.Build.0 = Debug|Any CPU
{F3BAB460-05C9-417A-BFDF-4FE93055A915}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F3BAB460-05C9-417A-BFDF-4FE93055A915}.Release|Any CPU.Build.0 = Release|Any CPU
{F3BAB460-05C9-417A-BFDF-4FE93055A915}.Release|x64.ActiveCfg = Release|Any CPU
{F3BAB460-05C9-417A-BFDF-4FE93055A915}.Release|x64.Build.0 = Release|Any CPU
{F3BAB460-05C9-417A-BFDF-4FE93055A915}.Release|x86.ActiveCfg = Release|Any CPU
{F3BAB460-05C9-417A-BFDF-4FE93055A915}.Release|x86.Build.0 = Release|Any CPU
{0F15D893-B455-4D44-8F00-AFCA9D90C1BE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0F15D893-B455-4D44-8F00-AFCA9D90C1BE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0F15D893-B455-4D44-8F00-AFCA9D90C1BE}.Debug|x64.ActiveCfg = Debug|Any CPU
{0F15D893-B455-4D44-8F00-AFCA9D90C1BE}.Debug|x64.Build.0 = Debug|Any CPU
{0F15D893-B455-4D44-8F00-AFCA9D90C1BE}.Debug|x86.ActiveCfg = Debug|Any CPU
{0F15D893-B455-4D44-8F00-AFCA9D90C1BE}.Debug|x86.Build.0 = Debug|Any CPU
{0F15D893-B455-4D44-8F00-AFCA9D90C1BE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0F15D893-B455-4D44-8F00-AFCA9D90C1BE}.Release|Any CPU.Build.0 = Release|Any CPU
{0F15D893-B455-4D44-8F00-AFCA9D90C1BE}.Release|x64.ActiveCfg = Release|Any CPU
{0F15D893-B455-4D44-8F00-AFCA9D90C1BE}.Release|x64.Build.0 = Release|Any CPU
{0F15D893-B455-4D44-8F00-AFCA9D90C1BE}.Release|x86.ActiveCfg = Release|Any CPU
{0F15D893-B455-4D44-8F00-AFCA9D90C1BE}.Release|x86.Build.0 = Release|Any CPU
{81827F08-E8C8-4366-8E0D-6F2C832371F1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{81827F08-E8C8-4366-8E0D-6F2C832371F1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{81827F08-E8C8-4366-8E0D-6F2C832371F1}.Debug|x64.ActiveCfg = Debug|Any CPU
{81827F08-E8C8-4366-8E0D-6F2C832371F1}.Debug|x64.Build.0 = Debug|Any CPU
{81827F08-E8C8-4366-8E0D-6F2C832371F1}.Debug|x86.ActiveCfg = Debug|Any CPU
{81827F08-E8C8-4366-8E0D-6F2C832371F1}.Debug|x86.Build.0 = Debug|Any CPU
{81827F08-E8C8-4366-8E0D-6F2C832371F1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{81827F08-E8C8-4366-8E0D-6F2C832371F1}.Release|Any CPU.Build.0 = Release|Any CPU
{81827F08-E8C8-4366-8E0D-6F2C832371F1}.Release|x64.ActiveCfg = Release|Any CPU
{81827F08-E8C8-4366-8E0D-6F2C832371F1}.Release|x64.Build.0 = Release|Any CPU
{81827F08-E8C8-4366-8E0D-6F2C832371F1}.Release|x86.ActiveCfg = Release|Any CPU
{81827F08-E8C8-4366-8E0D-6F2C832371F1}.Release|x86.Build.0 = Release|Any CPU
{AA9993DE-EE40-4884-AA5B-1A5AB630B123}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{AA9993DE-EE40-4884-AA5B-1A5AB630B123}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AA9993DE-EE40-4884-AA5B-1A5AB630B123}.Debug|x64.ActiveCfg = Debug|Any CPU
{AA9993DE-EE40-4884-AA5B-1A5AB630B123}.Debug|x64.Build.0 = Debug|Any CPU
{AA9993DE-EE40-4884-AA5B-1A5AB630B123}.Debug|x86.ActiveCfg = Debug|Any CPU
{AA9993DE-EE40-4884-AA5B-1A5AB630B123}.Debug|x86.Build.0 = Debug|Any CPU
{AA9993DE-EE40-4884-AA5B-1A5AB630B123}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AA9993DE-EE40-4884-AA5B-1A5AB630B123}.Release|Any CPU.Build.0 = Release|Any CPU
{AA9993DE-EE40-4884-AA5B-1A5AB630B123}.Release|x64.ActiveCfg = Release|Any CPU
{AA9993DE-EE40-4884-AA5B-1A5AB630B123}.Release|x64.Build.0 = Release|Any CPU
{AA9993DE-EE40-4884-AA5B-1A5AB630B123}.Release|x86.ActiveCfg = Release|Any CPU
{AA9993DE-EE40-4884-AA5B-1A5AB630B123}.Release|x86.Build.0 = Release|Any CPU
{DB802A16-1630-4C3D-A366-EB96A2C5AEBC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DB802A16-1630-4C3D-A366-EB96A2C5AEBC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DB802A16-1630-4C3D-A366-EB96A2C5AEBC}.Debug|x64.ActiveCfg = Debug|Any CPU
{DB802A16-1630-4C3D-A366-EB96A2C5AEBC}.Debug|x64.Build.0 = Debug|Any CPU
{DB802A16-1630-4C3D-A366-EB96A2C5AEBC}.Debug|x86.ActiveCfg = Debug|Any CPU
{DB802A16-1630-4C3D-A366-EB96A2C5AEBC}.Debug|x86.Build.0 = Debug|Any CPU
{DB802A16-1630-4C3D-A366-EB96A2C5AEBC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DB802A16-1630-4C3D-A366-EB96A2C5AEBC}.Release|Any CPU.Build.0 = Release|Any CPU
{DB802A16-1630-4C3D-A366-EB96A2C5AEBC}.Release|x64.ActiveCfg = Release|Any CPU
{DB802A16-1630-4C3D-A366-EB96A2C5AEBC}.Release|x64.Build.0 = Release|Any CPU
{DB802A16-1630-4C3D-A366-EB96A2C5AEBC}.Release|x86.ActiveCfg = Release|Any CPU
{DB802A16-1630-4C3D-A366-EB96A2C5AEBC}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -166,6 +250,12 @@ Global
{9DD063D3-CAE1-49C2-9C24-DE3499E79322} = {25B4D0F2-96D1-4F34-896E-ABA1E803A230}
{0DD5F47B-EDA3-405A-A2F3-08CB2566E30D} = {25B4D0F2-96D1-4F34-896E-ABA1E803A230}
{5DAF9603-999A-4759-AEE4-5E0F4D6D9AF7} = {25B4D0F2-96D1-4F34-896E-ABA1E803A230}
{689572FA-D5BA-4C70-94EA-C7CD3C1F2815} = {25B4D0F2-96D1-4F34-896E-ABA1E803A230}
{F3BAB460-05C9-417A-BFDF-4FE93055A915} = {25B4D0F2-96D1-4F34-896E-ABA1E803A230}
{0F15D893-B455-4D44-8F00-AFCA9D90C1BE} = {25B4D0F2-96D1-4F34-896E-ABA1E803A230}
{81827F08-E8C8-4366-8E0D-6F2C832371F1} = {25B4D0F2-96D1-4F34-896E-ABA1E803A230}
{AA9993DE-EE40-4884-AA5B-1A5AB630B123} = {25B4D0F2-96D1-4F34-896E-ABA1E803A230}
{DB802A16-1630-4C3D-A366-EB96A2C5AEBC} = {25B4D0F2-96D1-4F34-896E-ABA1E803A230}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {F4D963C1-44FE-45AE-9B2A-11CD86C7539F}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,14 +183,10 @@ public async Task AppOfflineDroppedWhileSiteRunning_SiteShutsDown_OutOfProcess()
{
var deploymentResult = await AssertStarts(HostingModel.OutOfProcess);

// Repeat dropping file and restarting multiple times
for (int i = 0; i < 5; i++)
{
AddAppOffline(deploymentResult.ContentRoot);
await AssertAppOffline(deploymentResult);
RemoveAppOffline(deploymentResult.ContentRoot);
await AssertRunning(deploymentResult);
}
AddAppOffline(deploymentResult.ContentRoot);
await AssertAppOffline(deploymentResult);
RemoveAppOffline(deploymentResult.ContentRoot);
await AssertRunning(deploymentResult);

AddAppOffline(deploymentResult.ContentRoot);
await AssertAppOffline(deploymentResult);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@
using Microsoft.AspNetCore.Server.IIS.FunctionalTests.Utilities;
using Microsoft.AspNetCore.Server.IntegrationTesting;
using Microsoft.AspNetCore.Server.IntegrationTesting.IIS;
using Microsoft.AspNetCore.Testing;
using Microsoft.AspNetCore.Testing.xunit;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Testing;
using Xunit;

namespace Microsoft.AspNetCore.Server.IIS.FunctionalTests.InProcess
Expand Down Expand Up @@ -76,7 +78,11 @@ public async Task CheckFailedRequestEvents()
AssertFrebLogs(result, new FrebLogItem("ANCM_INPROC_ASYNC_COMPLETION_COMPLETION", "2"));
}

// I think this test is flaky due to freb file not being created quickly enough.
// Adding extra logging, marking as flaky, and repeating should help
[ConditionalFact]
[Flaky("https://github.com/aspnet/AspNetCore-Internal/issues/2570", FlakyOn.Helix.All)]
[Repeat(10)]
[RequiresIIS(IISCapability.FailedRequestTracingModule)]
public async Task CheckFrebDisconnect()
{
Expand Down Expand Up @@ -120,16 +126,18 @@ private void AssertFrebLogs(IISDeploymentResult result, IEnumerable<FrebLogItem>
var frebEvent = GetFrebLogItems(result);
foreach (var expectedEvent in expectedFrebEvents)
{
result.Logger.LogInformation($"Checking if {expectedEvent.ToString()} exists.");
Assert.Contains(expectedEvent, frebEvent);
}
}

private IEnumerable<FrebLogItem> GetFrebLogItems(IISDeploymentResult result)
{
var folderPath = Helpers.GetFrebFolder(_logFolderPath, result);
var xmlFiles = Directory.GetFiles(folderPath).Where(f => f.EndsWith("xml"));
var xmlFiles = Directory.GetFiles(folderPath).Where(f => f.EndsWith("xml")).ToList();
var frebEvents = new List<FrebLogItem>();

result.Logger.LogInformation($"Number of freb files available {xmlFiles.Count}.");
foreach (var xmlFile in xmlFiles)
{
var xDocument = XDocument.Load(xmlFile).Root;
Expand Down Expand Up @@ -174,6 +182,11 @@ public override int GetHashCode()
{
return HashCode.Combine(_opCode, _requestStatus);
}

public override string ToString()
{
return $"FrebLogItem: opCode: {_opCode}, requestStatus: {_requestStatus}";
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
using System.Net;
using System.Net.Http;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Server.IIS;
using Microsoft.AspNetCore.Server.IIS.FunctionalTests.Utilities;
using Microsoft.AspNetCore.Server.IntegrationTesting;
using Microsoft.AspNetCore.Server.IntegrationTesting.IIS;
Expand Down Expand Up @@ -91,6 +90,9 @@ public async Task SetIISLimitMaxRequestBodyLogsWarning()

var result = await deploymentResult.HttpClient.PostAsync("/DecreaseRequestLimit", new StringContent("1"));
Assert.Equal(HttpStatusCode.OK, result.StatusCode);

StopServer();

if (deploymentParameters.ServerType == ServerType.IISExpress)
{
Assert.Single(TestSink.Writes, w => w.Message.Contains("Increasing the MaxRequestBodySize conflicts with the max value for IIS limit maxAllowedContentLength." +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
using System.Xml.Linq;
using Microsoft.AspNetCore.Server.IntegrationTesting;
using Microsoft.AspNetCore.Server.IntegrationTesting.IIS;
using Microsoft.AspNetCore.Testing;
using Microsoft.Extensions.Logging;
using Newtonsoft.Json;
using Xunit;
Expand All @@ -20,7 +19,7 @@ namespace Microsoft.AspNetCore.Server.IIS.FunctionalTests
{
public static class Helpers
{
private static readonly TimeSpan RetryRequestDelay = TimeSpan.FromMilliseconds(100);
private static readonly TimeSpan RetryRequestDelay = TimeSpan.FromMilliseconds(10);
private static readonly int RetryRequestCount = 10;

public static string GetInProcessTestSitesName()
Expand Down Expand Up @@ -105,12 +104,14 @@ public static Task<HttpResponseMessage> RetryRequestAsync(this HttpClient client
public static async Task<HttpResponseMessage> RetryRequestAsync(this HttpClient client, string uri, Func<HttpResponseMessage, Task<bool>> predicate)
{
HttpResponseMessage response = await client.GetAsync(uri);

var delay = RetryRequestDelay;
for (var i = 0; i < RetryRequestCount && !await predicate(response); i++)
{
// Keep retrying until app_offline is present.
response = await client.GetAsync(uri);
await Task.Delay(RetryRequestDelay);
await Task.Delay(delay);
// This will max out at a 5 second delay
delay *= 2;
}

if (!await predicate(response))
Expand Down
12 changes: 6 additions & 6 deletions src/Servers/IIS/IIS/test/IIS.Tests/ClientDisconnectTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
using System.Threading;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Connections;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Server.IntegrationTesting;
using Microsoft.AspNetCore.Testing;
using Microsoft.AspNetCore.Testing.xunit;
Expand All @@ -20,19 +19,20 @@ namespace Microsoft.AspNetCore.Server.IIS.FunctionalTests
public class ClientDisconnectTests : StrictTestServerTests
{
[ConditionalFact]
[Flaky("https://github.com/aspnet/AspNetCore-Internal/issues/2358", FlakyOn.All)]
public async Task WritesSucceedAfterClientDisconnect()
{
var requestStartedCompletionSource = CreateTaskCompletionSource();
var clientDisconnectedCompletionSource = CreateTaskCompletionSource();
var requestCompletedCompletionSource = CreateTaskCompletionSource();
var requestAborted = CreateTaskCompletionSource();

var data = new byte[1024];
using (var testServer = await TestServer.Create(
async ctx =>
{
requestStartedCompletionSource.SetResult(true);
await clientDisconnectedCompletionSource.Task;
ctx.RequestAborted.Register(() => requestAborted.SetResult(true));

await requestAborted.Task.DefaultTimeout();
for (var i = 0; i < 1000; i++)
{
await ctx.Response.Body.WriteAsync(data);
Expand All @@ -46,7 +46,8 @@ public async Task WritesSucceedAfterClientDisconnect()
await SendContentLength1Post(connection);
await requestStartedCompletionSource.Task.DefaultTimeout();
}
clientDisconnectedCompletionSource.SetResult(true);

await requestAborted.Task.DefaultTimeout();

await requestCompletedCompletionSource.Task.DefaultTimeout();
}
Expand All @@ -55,7 +56,6 @@ public async Task WritesSucceedAfterClientDisconnect()
}

[ConditionalFact]
[Repeat(20)]
public async Task WritesCanceledWhenUsingAbortedToken()
{
var requestStartedCompletionSource = CreateTaskCompletionSource();
Expand Down
12 changes: 11 additions & 1 deletion src/Servers/IIS/IntegrationTesting.IIS/src/IISExpressDeployer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,8 @@ private string CheckIfPublishIsRequired()
Logger.LogInformation("Started iisexpress successfully. Process Id : {processId}, Port: {port}", _hostProcess.Id, port);
return (url: url, hostExitToken: hostExitTokenSource.Token);
}

ChangePort(contentRoot, (uri.Scheme == "https") ? TestPortHelper.GetNextSSLPort() : TestPortHelper.GetNextPort());
}

var message = $"Failed to initialize IIS Express after {MaximumAttempts} attempts to select a port";
Expand All @@ -274,7 +276,7 @@ private string CheckIfPublishIsRequired()

private void PrepareConfig(string contentRoot, int port)
{
var serverConfig = DeploymentParameters.ServerConfigTemplateContent;;
var serverConfig = DeploymentParameters.ServerConfigTemplateContent;
// Config is required. If not present then fall back to one we carry with us.
if (string.IsNullOrEmpty(serverConfig))
{
Expand Down Expand Up @@ -313,6 +315,14 @@ private void PrepareConfig(string contentRoot, int port)
File.WriteAllText(DeploymentParameters.ServerConfigLocation, serverConfig);
}

private void ChangePort(string contentRoot, int port)
{
var serverConfig = File.ReadAllText(DeploymentParameters.ServerConfigLocation);
XDocument config = XDocument.Parse(serverConfig);
ConfigureModuleAndBinding(config.Root, contentRoot, port);
File.WriteAllText(DeploymentParameters.ServerConfigLocation, serverConfig);
}

private void AddAspNetCoreElement(XElement config)
{
var aspNetCore = config
Expand Down