Skip to content

Commit

Permalink
Disable failing MsQuic tests on Windows (#69798)
Browse files Browse the repository at this point in the history
* Disable failing MsQuic tests on Windows

* Switch to SkipTestException
  • Loading branch information
rzikm committed May 26, 2022
1 parent df62da3 commit 5d3288d
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
Expand Up @@ -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);
Expand Down Expand Up @@ -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
{
Expand Down
14 changes: 12 additions & 2 deletions src/libraries/System.Net.Quic/tests/FunctionalTests/MsQuicTests.cs
Expand Up @@ -105,9 +105,14 @@ public async Task ConnectWithCertificateChain()
clientConnection.Dispose();
}

[Fact]
[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();
Expand Down Expand Up @@ -334,11 +339,16 @@ public async Task ConnectWithCertificateForLoopbackIP_IndicatesExpectedError(str
(QuicConnection clientConnection, QuicConnection serverConnection) = await CreateConnectedQuicConnection(clientOptions, listenerOptions);
}

[Theory]
[ConditionalTheory]
[InlineData(true)]
[InlineData(false)]
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();
Expand Down

0 comments on commit 5d3288d

Please sign in to comment.