-
Notifications
You must be signed in to change notification settings - Fork 289
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
Open
edwardneal
wants to merge
10
commits into
dotnet:main
Choose a base branch
from
edwardneal:tests/certificate-generation
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+432
−411
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
mdaigle
added
➕ Code Health
Issues/PRs that are targeted to source code quality improvements.
Area\Tests
Issues that are targeted to tests or test projects
and removed
➕ Code Health
Issues/PRs that are targeted to source code quality improvements.
labels
Nov 25, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
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.