Fix test failures in CertificateValidationClientServer_EndToEnd_Ok (dotnet/corefx...
authorDavid Shulman <david.shulman@microsoft.com>
Mon, 11 Feb 2019 04:37:47 +0000 (20:37 -0800)
committerGitHub <noreply@github.com>
Mon, 11 Feb 2019 04:37:47 +0000 (20:37 -0800)
commitad60240162e5d4a4156d459c45ec1980be5bce4c
treeacc1098b7a67d7d0b533e683e8dee8bc5942166d
parenteaf34d805e0acfa1cbf7c65c5c207f99cef6d782
Fix test failures in CertificateValidationClientServer_EndToEnd_Ok (dotnet/corefx#35225)

This System.Net.Security Functional test was always failing on my machine.
But not failing in CI. The reason is that the CI machines don't have the
TestRoot certificate installed but my machine does.

So `Capability.IsTrustedRootCertificateInstalled()` is always false on the
CI machines but true on my machine.

Due to this test almost never running that codepath, the test got bad due to
some prior refactoring and the failure wasn't noticed until now. The test was
making an incorrect assumption about the contents and sizes of certificate
collections.

I fixed the test so that it validates what it should have been doing all along.
The validation is about checking that the received/built trusted chain is valid
and that the end-entity certificate is on that chain and is trusted by the root
on that chain.

Commit migrated from https://github.com/dotnet/corefx/commit/224fa8e1e58b10b7fe1a5d3cfdedf2a1afbfe2e1
src/libraries/System.Net.Security/tests/FunctionalTests/CertificateChainValidation.cs [deleted file]
src/libraries/System.Net.Security/tests/FunctionalTests/CertificateValidationClientServer.cs
src/libraries/System.Net.Security/tests/FunctionalTests/System.Net.Security.Tests.csproj