-
Notifications
You must be signed in to change notification settings - Fork 302
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
Tests | Remove hardcoded certificates from functional tests #3034
Tests | Remove hardcoded certificates from functional tests #3034
Conversation
Clients requiring a server certificate will need to generate their own.
* TestUtilities no longer targets netstandard2.0, so is now able to use CertificateRequest. * Added a reference from Tests to TestUtilities. * Added a base CertificateFixtureBase class. This provides basic infrastructure to generate a certificate and add it to a store (with cleanup on disposal.)
Removed multiple hardcoded references to three certificates. Also removed references to TestCertificate12.
This test class covered similar ground to the existing SqlColumnEncryptionCertificateStoreProviderShould test class.
Removes the last reference to Utility.CreateCertificate, replacing it with one which is generated dynamically. Accordingly, removes Utility.CreateCertificate.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #3034 +/- ##
==========================================
- Coverage 72.61% 72.61% -0.01%
==========================================
Files 285 285
Lines 59162 59162
==========================================
- Hits 42963 42958 -5
- Misses 16199 16204 +5
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's goooo 🚢 🚀 🌕
This is a pre-requisite for #3014. I'm splitting this prereq in half though, it's already a little unwieldy to review.
There are a variety of hardcoded certificates (most with private keys, one without) in the test code. This PR lays out some simple enough infrastructure which helps to replace them, then replaces all the references I can see in the functional tests.
Key features here:
CertificateFixtureBase
class to the TestUtilities project. This base class provides the infrastructure needed to generate an ad-hoc certificate. It'll use the CertificateRequest class in .NET Core, and it has to run PowerShell in .NET Framework (as per the current manual tests.) It also cleans up the certificates it leaves behind.ColumnEncryptionCertificateFixture
class to TestUtilities. This is derived from the above, and it generates a set of basic certificates, adding them to the appropriate store.SqlColumnEncryptionCertificateStoreProviderShould
tests, removing three hardcoded certificates (with private keys.) Switched this over to the above fixture class.ExceptionsCertStore
to remove its references to Utility.CreateCertificate, then realised that both of its tests were special cases of the above test class and removed them. In the process, I was also able to enable theCertificateWithNoPrivateKey
test on .NET Core.ExceptionsAlgorithmErrors
to the ColumnEncryptionCertificateFixture fixture class, removing the remaining reference to Utility.CreateCertificate.There are other hardcoded credentials in the manual tests, but this is already a large PR at +428/-407.