Skip to content

Commit 052bd57

Browse files
committed
Fix CloneSslOptionsClonesAllProperties test on Ubuntu 16.04
1 parent 25d354b commit 052bd57

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

src/Servers/Kestrel/Core/test/SniOptionsSelectorTests.cs

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -606,7 +606,7 @@ public void PrefersClientCertificateModeDefinedInSniConfig()
606606
new MockCertificateConfigLoader(),
607607
new HttpsConnectionAdapterOptions
608608
{
609-
ClientCertificateMode = ClientCertificateMode.AllowCertificate
609+
ClientCertificateMode = ClientCertificateMode.AllowCertificate
610610
},
611611
fallbackHttpProtocols: HttpProtocols.Http1AndHttp2,
612612
logger: Mock.Of<ILogger<HttpsConnectionMiddleware>>());
@@ -640,7 +640,7 @@ public void FallsBackToFallbackClientCertificateMode()
640640
new MockCertificateConfigLoader(),
641641
new HttpsConnectionAdapterOptions
642642
{
643-
ClientCertificateMode = ClientCertificateMode.AllowCertificate
643+
ClientCertificateMode = ClientCertificateMode.AllowCertificate
644644
},
645645
fallbackHttpProtocols: HttpProtocols.Http1AndHttp2,
646646
logger: Mock.Of<ILogger<HttpsConnectionMiddleware>>());
@@ -664,8 +664,17 @@ public void CloneSslOptionsClonesAllProperties()
664664

665665
if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
666666
{
667-
// The CipherSuitesPolicy ctor throws a PlatformNotSupportedException on Windows.
668-
cipherSuitesPolicy = new CipherSuitesPolicy(new[] { TlsCipherSuite.TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 });
667+
try
668+
{
669+
// The CipherSuitesPolicy ctor throws a PlatformNotSupportedException on Windows.
670+
cipherSuitesPolicy = new CipherSuitesPolicy(new[] { TlsCipherSuite.TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 });
671+
}
672+
catch (PlatformNotSupportedException)
673+
{
674+
// The CipherSuitesPolicy ctor throws a PlatformNotSupportedException on Ubuntu 16.04.
675+
// I don't know exactly which other distros/versions throw PNEs, but it isn't super relevant to this test,
676+
// so let's just swallow this exception.
677+
}
669678
}
670679

671680
// Set options properties to non-default values to verify they're copied.
@@ -760,7 +769,7 @@ public X509Certificate2 LoadCertificate(CertificateConfig certInfo, string endpo
760769

761770
private class MockConnectionContext : ConnectionContext
762771
{
763-
public override IDuplexPipe Transport { get => throw new System.NotImplementedException(); set => throw new System.NotImplementedException(); }
772+
public override IDuplexPipe Transport { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
764773
public override string ConnectionId { get; set; } = "MockConnectionId";
765774
public override IFeatureCollection Features { get; } = new FeatureCollection();
766775
public override IDictionary<object, object> Items { get; set; } = new Dictionary<object, object>();

0 commit comments

Comments
 (0)