skip SslStream_ClientCertificate_SendsChain test if chain is not valid (#48261)
authorTomas Weinfurt <tweinfurt@yahoo.com>
Sat, 13 Feb 2021 21:38:58 +0000 (13:38 -0800)
committerGitHub <noreply@github.com>
Sat, 13 Feb 2021 21:38:58 +0000 (13:38 -0800)
* skip SslStream_ClientCertificate_SendsChain test if chain is not valid

* make test conditional

src/libraries/System.Net.Security/tests/FunctionalTests/SslStreamNetworkStreamTest.cs

index 29039f5..de506cd 100644 (file)
@@ -349,7 +349,7 @@ namespace System.Net.Security.Tests
             }
         }
 
-        [Fact]
+        [ConditionalFact]
         [ActiveIssue("https://github.com/dotnet/runtime/issues/46837", TestPlatforms.OSX)]
         public async Task SslStream_ClientCertificate_SendsChain()
         {
@@ -371,7 +371,10 @@ namespace System.Net.Security.Tests
                 chain.ChainPolicy.DisableCertificateDownloads = false;
                 bool chainStatus = chain.Build(clientCertificate);
                 // Verify we can construct full chain
-                Assert.True(chain.ChainElements.Count >= clientChain.Count, "chain cannot be built");
+                if (chain.ChainElements.Count < clientChain.Count)
+                {
+                    throw new SkipTestException($"chain cannot be built {chain.ChainElements.Count}");
+                }
             }
 
             var clientOptions = new  SslClientAuthenticationOptions() { TargetHost = "localhost",  };