Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Tests | Remove hardcoded certificates from functional tests#3034

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged

Conversation

edwardneal
Copy link
Contributor

@edwardnealedwardneal commentedNov 24, 2024
edited
Loading

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:

  • TDS.Servers and TDS.EndPoint have had some minor rework. I removed the hardcoded default certificate, it'll now throw an exception if one is missing and we try to use SSL connections.
  • Added aCertificateFixtureBase 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.
  • Added aColumnEncryptionCertificateFixture class to TestUtilities. This is derived from the above, and it generates a set of basic certificates, adding them to the appropriate store.
  • Reworked theSqlColumnEncryptionCertificateStoreProviderShould tests, removing three hardcoded certificates (with private keys.) Switched this over to the above fixture class.
  • Started to work onExceptionsCertStore 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.
  • SwitchedExceptionsAlgorithmErrors to the ColumnEncryptionCertificateFixture fixture class, removing the remaining reference to Utility.CreateCertificate.
  • Removed Utility.CreateCertificate (which in reality, just returned the same certificate every time.)

There are other hardcoded credentials in the manual tests, but this is already a large PR at +428/-407.

David-Engel and cheenamalhotra reacted with heart emoji
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.
@codecovCodecov
Copy link

codecovbot commentedNov 24, 2024
edited
Loading

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 72.61%. Comparing base(22ac587) to head(1ff8f1c).
Report is 15 commits behind head on main.

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
FlagCoverage Δ
addons92.58% <ø> (ø)
netcore75.42% <ø> (-0.01%)⬇️
netfx71.02% <ø> (+0.02%)⬆️

Flags with carried forward coverage won't be shown.Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report?Share it here.

@mdaiglemdaigle added Code Health 💊Issues/PRs that are targeted to source code quality improvements. Area\TestsIssues that are targeted to tests or test projects and removed Code Health 💊Issues/PRs that are targeted to source code quality improvements. labelsNov 25, 2024
Copy link
Contributor

@benrr101benrr101 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Let's goooo 🚢 🚀 🌕

@benrr101benrr101 merged commitbb4c3b7 intodotnet:mainDec 2, 2024
130 checks passed
@edwardnealedwardneal deleted the tests/certificate-generation branchDecember 3, 2024 05:24
@mdaiglemdaigle added this to the7.0-preview1 milestoneJan 14, 2025
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@benrr101benrr101benrr101 approved these changes

@cheenamalhotracheenamalhotracheenamalhotra approved these changes

Assignees
No one assigned
Labels
Area\TestsIssues that are targeted to tests or test projects
Projects
None yet
Milestone
6.1-preview1
Development

Successfully merging this pull request may close these issues.

4 participants
@edwardneal@benrr101@cheenamalhotra@mdaigle

[8]ページ先頭

©2009-2025 Movatter.jp