From 8acd1ed160d21cb8a6f6e9cc4f4ae9cc47e0333e Mon Sep 17 00:00:00 2001 From: Radek Zikmund Date: Wed, 25 May 2022 16:55:15 +0200 Subject: [PATCH 1/2] Disable failing MsQuic tests on Windows --- .../System.Net.Quic/tests/FunctionalTests/MsQuicTests.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/libraries/System.Net.Quic/tests/FunctionalTests/MsQuicTests.cs b/src/libraries/System.Net.Quic/tests/FunctionalTests/MsQuicTests.cs index fe8a3eb1d9a2e..0e447ab8915ea 100644 --- a/src/libraries/System.Net.Quic/tests/FunctionalTests/MsQuicTests.cs +++ b/src/libraries/System.Net.Quic/tests/FunctionalTests/MsQuicTests.cs @@ -106,6 +106,7 @@ public async Task ConnectWithCertificateChain() } [Fact] + [ActiveIssue("https://github.com/dotnet/runtime/issues/69792", typeof(PlatformDetection), nameof(PlatformDetection.IsWindows10Version20348OrGreater))] public async Task UntrustedClientCertificateFails() { var listenerOptions = new QuicListenerOptions(); @@ -337,6 +338,7 @@ public async Task ConnectWithCertificateForLoopbackIP_IndicatesExpectedError(str [Theory] [InlineData(true)] [InlineData(false)] + [ActiveIssue("https://github.com/dotnet/runtime/issues/69792", typeof(PlatformDetection), nameof(PlatformDetection.IsWindows10Version20348OrGreater))] public async Task ConnectWithClientCertificate(bool sendCertificate) { bool clientCertificateOK = false; From 0a7ec60b4fac816e7bf0cc2ca0e535225830a0bf Mon Sep 17 00:00:00 2001 From: Radek Zikmund Date: Wed, 25 May 2022 18:13:23 +0200 Subject: [PATCH 2/2] Switch to SkipTestException --- .../System/PlatformDetection.Windows.cs | 7 ++++++- .../tests/FunctionalTests/MsQuicTests.cs | 16 ++++++++++++---- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.Windows.cs b/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.Windows.cs index c51437bae4f2c..6448f7cc42d4b 100644 --- a/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.Windows.cs +++ b/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.Windows.cs @@ -61,7 +61,7 @@ public static partial class PlatformDetection // Windows Server 2022 public static bool IsWindows10Version20348OrGreater => IsWindowsVersionOrLater(10, 0, 20348); - + public static bool IsWindows10Version20348OrLower => IsWindowsVersionOrEarlier(10, 0, 20348); // Windows 11 aka 21H2 public static bool IsWindows10Version22000OrGreater => IsWindowsVersionOrLater(10, 0, 22000); @@ -179,6 +179,11 @@ internal static bool IsWindowsVersionOrLater(int major, int minor, int build = - return IsWindows && GetWindowsVersionObject() >= (build != -1 ? new Version(major, minor, build) : new Version(major, minor)); } + internal static bool IsWindowsVersionOrEarlier(int major, int minor, int build = -1) + { + return IsWindows && GetWindowsVersionObject() <= (build != -1 ? new Version(major, minor, build) : new Version(major, minor)); + } + private static int s_isInAppContainer = -1; public static bool IsInAppContainer { diff --git a/src/libraries/System.Net.Quic/tests/FunctionalTests/MsQuicTests.cs b/src/libraries/System.Net.Quic/tests/FunctionalTests/MsQuicTests.cs index 0e447ab8915ea..2876d33551a6c 100644 --- a/src/libraries/System.Net.Quic/tests/FunctionalTests/MsQuicTests.cs +++ b/src/libraries/System.Net.Quic/tests/FunctionalTests/MsQuicTests.cs @@ -105,10 +105,14 @@ public async Task ConnectWithCertificateChain() clientConnection.Dispose(); } - [Fact] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69792", typeof(PlatformDetection), nameof(PlatformDetection.IsWindows10Version20348OrGreater))] + [ConditionalFact] public async Task UntrustedClientCertificateFails() { + if (PlatformDetection.IsWindows10Version20348OrLower) + { + throw new SkipTestException("Client certificates are not supported on Windows Server 2022."); + } + var listenerOptions = new QuicListenerOptions(); listenerOptions.ListenEndPoint = new IPEndPoint(IPAddress.Loopback, 0); listenerOptions.ServerAuthenticationOptions = GetSslServerAuthenticationOptions(); @@ -335,12 +339,16 @@ public async Task ConnectWithCertificateForLoopbackIP_IndicatesExpectedError(str (QuicConnection clientConnection, QuicConnection serverConnection) = await CreateConnectedQuicConnection(clientOptions, listenerOptions); } - [Theory] + [ConditionalTheory] [InlineData(true)] [InlineData(false)] - [ActiveIssue("https://github.com/dotnet/runtime/issues/69792", typeof(PlatformDetection), nameof(PlatformDetection.IsWindows10Version20348OrGreater))] public async Task ConnectWithClientCertificate(bool sendCertificate) { + if (PlatformDetection.IsWindows10Version20348OrLower) + { + throw new SkipTestException("Client certificates are not supported on Windows Server 2022."); + } + bool clientCertificateOK = false; var listenerOptions = new QuicListenerOptions();