Skip to content

Commit

Permalink
Run MsQuic tests in parallel again. (dotnet#100947)
Browse files Browse the repository at this point in the history
* Run MsQuic tests in parallel.

* Removed workarounds in other parts of the code.

* Remove filter in active issue for failing test

* Remove extra property
  • Loading branch information
rzikm authored and matouskozak committed Apr 30, 2024
1 parent 078508d commit e551dd5
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4024,47 +4024,41 @@ public SocketsHttpHandler_HttpClientHandler_Cancellation_Test_Http2(ITestOutputH
protected override Version UseVersion => HttpVersion.Version20;
}

[Collection(nameof(DisableParallelization))]
[ConditionalClass(typeof(HttpClientHandlerTestBase), nameof(IsQuicSupported))]
public sealed class SocketsHttpHandlerTest_HttpClientHandlerTest_Http3 : HttpClientHandlerTest
{
public SocketsHttpHandlerTest_HttpClientHandlerTest_Http3(ITestOutputHelper output) : base(output) { }
protected override Version UseVersion => HttpVersion.Version30;
}

[Collection(nameof(DisableParallelization))]
[ConditionalClass(typeof(HttpClientHandlerTestBase), nameof(IsQuicSupported))]
public sealed class SocketsHttpHandlerTest_Cookies_Http3 : HttpClientHandlerTest_Cookies
{
public SocketsHttpHandlerTest_Cookies_Http3(ITestOutputHelper output) : base(output) { }
protected override Version UseVersion => HttpVersion.Version30;
}

[Collection(nameof(DisableParallelization))]
[ConditionalClass(typeof(HttpClientHandlerTestBase), nameof(IsQuicSupported))]
public sealed class SocketsHttpHandlerTest_HttpClientHandlerTest_Headers_Http3 : HttpClientHandlerTest_Headers
{
public SocketsHttpHandlerTest_HttpClientHandlerTest_Headers_Http3(ITestOutputHelper output) : base(output) { }
protected override Version UseVersion => HttpVersion.Version30;
}

[Collection(nameof(DisableParallelization))]
[ConditionalClass(typeof(HttpClientHandlerTestBase), nameof(IsQuicSupported))]
public sealed class SocketsHttpHandler_HttpClientHandler_Cancellation_Test_Http3 : SocketsHttpHandler_Cancellation_Test
{
public SocketsHttpHandler_HttpClientHandler_Cancellation_Test_Http3(ITestOutputHelper output) : base(output) { }
protected override Version UseVersion => HttpVersion.Version30;
}

[Collection(nameof(DisableParallelization))]
[ConditionalClass(typeof(HttpClientHandlerTestBase), nameof(IsQuicSupported))]
public sealed class SocketsHttpHandler_HttpClientHandler_AltSvc_Test_Http3 : HttpClientHandler_AltSvc_Test
{
public SocketsHttpHandler_HttpClientHandler_AltSvc_Test_Http3(ITestOutputHelper output) : base(output) { }
protected override Version UseVersion => HttpVersion.Version30;
}

[Collection(nameof(DisableParallelization))]
[ConditionalClass(typeof(HttpClientHandlerTestBase), nameof(IsQuicSupported))]
public sealed class SocketsHttpHandler_HttpClientHandler_Finalization_Http3 : HttpClientHandler_Finalization_Test
{
Expand Down Expand Up @@ -4328,7 +4322,7 @@ await LoopbackServerFactory.CreateClientAndServerAsync(
};
policy.ExtraStore.AddRange(caCerts);
policy.CustomTrustStore.Add(caCerts[caCerts.Count -1]);
policy.CustomTrustStore.Add(caCerts[caCerts.Count - 1]);
socketsHandler.SslOptions = new SslClientAuthenticationOptions() { CertificateChainPolicy = policy };
using HttpClient client = CreateHttpClient(handler);
Expand Down Expand Up @@ -4490,7 +4484,7 @@ await LoopbackServerFactory.CreateClientAndServerAsync(async uri =>
options: new GenericLoopbackOptions() { UseSsl = true });
}


}

public sealed class SocketsHttpHandler_HttpRequestErrorTest_Http11 : SocketsHttpHandler_HttpRequestErrorTest
Expand Down Expand Up @@ -4533,7 +4527,6 @@ await Http11LoopbackServerFactory.Singleton.CreateClientAndServerAsync(async uri
}
}

[Collection(nameof(DisableParallelization))]
[ConditionalClass(typeof(HttpClientHandlerTestBase), nameof(IsQuicSupported))]
public sealed class SocketsHttpHandler_HttpRequestErrorTest_Http30 : SocketsHttpHandler_HttpRequestErrorTest
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
using System.Net.Quic;
using Microsoft.Quic;

[assembly:SupportedOSPlatform("windows")]
[assembly:SupportedOSPlatform("linux")]
[assembly: SupportedOSPlatform("windows")]
[assembly: SupportedOSPlatform("linux")]

namespace HttpStress
{
Expand Down Expand Up @@ -186,24 +186,6 @@ private static async Task<ExitCode> Run(Configuration config)
Console.WriteLine("Query Parameters: " + config.MaxParameters);
Console.WriteLine();

if (config.HttpVersion == HttpVersion.Version30 && IsQuicSupported)
{
unsafe
{
// If the system gets overloaded, MsQuic has a tendency to drop incoming connections, see https://github.com/dotnet/runtime/issues/55979.
// So in case we're running H/3 stress test, we're using the same hack as for System.Net.Quic tests, which increases the time limit for pending operations in MsQuic thread pool.
object msQuicApiInstance = msQuicApiType.GetProperty("Api", BindingFlags.NonPublic | BindingFlags.Static)!.GetGetMethod(true)!.Invoke(null, Array.Empty<object?>())!;
QUIC_API_TABLE* apiTable = (QUIC_API_TABLE*)(Pointer.Unbox(msQuicApiType.GetProperty("ApiTable")!.GetGetMethod()!.Invoke(msQuicApiInstance, Array.Empty<object?>())!));
QUIC_SETTINGS settings = default(QUIC_SETTINGS);
settings.IsSet.MaxWorkerQueueDelayUs = 1;
settings.MaxWorkerQueueDelayUs = 2_500_000u; // 2.5s, 10x the default
if (MsQuic.StatusFailed(apiTable->SetParam(null, MsQuic.QUIC_PARAM_GLOBAL_SETTINGS, (uint)sizeof(QUIC_SETTINGS), (byte*)&settings)))
{
Console.WriteLine($"Unable to set MsQuic MaxWorkerQueueDelayUs.");
}
}
}

StressServer? server = null;
if (config.RunMode.HasFlag(RunMode.server))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ private MsQuicApi(QUIC_API_TABLE* apiTable)
internal static string? NotSupportedReason { get; }

// workaround for https://github.com/microsoft/msquic/issues/4132
internal static bool SupportsAsyncCertValidation => Version >= new Version(2, 4, 0);
internal static bool SupportsAsyncCertValidation => Version >= new Version(2, 3, 5);

internal static bool UsesSChannelBackend { get; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -357,10 +357,8 @@ public async Task UntrustedClientCertificateFails()
}
}

static bool SupportsAsyncCertValidation => QuicTestCollection.MsQuicVersion >= new Version(2, 4);

[Fact]
[ActiveIssue("https://github.com/dotnet/runtime/issues/99074", typeof(MsQuicTests), nameof(SupportsAsyncCertValidation))]
[ActiveIssue("https://github.com/dotnet/runtime/issues/99074")]
public async Task CertificateCallbackThrowPropagates()
{
using CancellationTokenSource cts = new CancellationTokenSource(PassingTestTimeout);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

namespace System.Net.Quic.Tests;

[CollectionDefinition(nameof(QuicTestCollection), DisableParallelization = true)]
[CollectionDefinition(nameof(QuicTestCollection))]
public unsafe class QuicTestCollection : ICollectionFixture<QuicTestCollection>, IDisposable
{
public static bool IsSupported => QuicListener.IsSupported && QuicConnection.IsSupported;
Expand Down

0 comments on commit e551dd5

Please sign in to comment.