Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable failing MsQuic tests on Windows #69798

Merged
merged 2 commits into from
May 26, 2022
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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