-
Notifications
You must be signed in to change notification settings - Fork 317
Tests | Refactor and move CoreCryptoTests to UnitTests #3709
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
Conversation
|
/azp run |
|
Azure Pipelines successfully started running 2 pipeline(s). |
|
Thanks @paulmedynski - I'd missed the extracted CEK certificate. I've just added it and pushed. |
|
/azp run |
|
Azure Pipelines successfully started running 2 pipeline(s). |
This isn't run on MacOS at the moment, and the CEK certificate isn't compatible with the OS.
|
The NativeColumnEncryptionKeyBaseline class' test was failing to run on Mac because the baseline CEK certificate couldn't be loaded by the OS. I've skipped the class for now, could someone re-run CI please? |
|
/azp run |
|
Azure Pipelines successfully started running 2 pipeline(s). |
Codecov Report✅ All modified and coverable lines are covered by tests.
Additional details and impacted files@@ Coverage Diff @@
## main #3709 +/- ##
==========================================
- Coverage 77.35% 69.99% -7.37%
==========================================
Files 271 266 -5
Lines 45123 43873 -1250
==========================================
- Hits 34907 30708 -4199
- Misses 10216 13165 +2949
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Description
This picks up from a comment yesterday in #3660 from @mdaigle, moving CoreCryptoTests into the unit tests project.
The CEK-based tests (
TestRsaCryptoWithNativeBaseline) had already removed the use of reflection, so I've ported those across. There were also AEAD-based tests which still used reflection, so I removed those too.The old version of the tests contained the
TCECryptoNativeBaseline.txtandTCECryptoNativeBaselineRsa.txtfiles, with various parsing logic to convert the hexadecimal strings into byte arrays. I've turned these byte arrays into embedded resources because several of them are about 4KB in size and I wanted to load them in a consistent way. I'm not completely happy with the approach though, it leads to a lot of small files. I did consider putting them in one or more JSON files (so we'd eliminate the use of the custom parsing logic without adding so many files - perhaps one file for each of the 32 AEAD-based test cases and the 3 CEK-based test cases) but it seemed like an unnecessary layer of indirection. I'm happy to go with whichever option you'd prefer.It's also worth noting that this lifts a hardcoded certificate out of
TCECryptoNativeBaselineRsa.txt. This was always there, but it's technically a hardcoded credential and might be noticed as such. We use this to decrypt a CEK and verify its contents against the SQL Server native code, so it needs to remain in situ.Issues
Follows up #3660 comment.
Testing
New tests run successfully.