Test Fix and single test run command #228
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The test TestKeysFromCertificatesCreatedWithMultipleCryptoProviders was failing because it was trying to cast an RSACng private key into an RSACryptoServiceProvider and that isn't possible. The test is attempting to verify that csp providers roundtrip properly so it isn't designed to cope with Cng keys.
I've changed the certificate path fetch logic to return null for non-csp private keys without crashing and added a check on the path so the loop skips to the next item if the path is null. This effectively skips the cng provider(s).
I also updated two tests to make sure that if a certificate file is generated it will be cleaned up even if the test fails. This stops certificates being added to the store and never removed. I had quite a few in there.
Test Microsoft.Data.SqlClient.ManualTesting.Tests.AlwaysEncrypted.CspProviderExt.TestRoundTripWithCSPAndCertStoreProvider is marked as
[Fact(Skip = "Failing in TCE")]
what is tce? It's the other place that uses the get csp path function.I added the run command needed for running a specific command in case it's help for anyone else trying to debug single tests in future.