Tests | Add collation transcoding tests#4051
Merged
cheenamalhotra merged 2 commits intodotnet:mainfrom Apr 8, 2026
Merged
Conversation
This previously only tested Kazakh_90_CI_AI and Georgian_Modern_Sort_CI_AS. The replacement tests every collation. It also performs a more comprehensive check that the string/byte[] roundtrips with the varbinary/varchar from the database instance. Finally, it no longer requires permission to drop and create databases: we can just use the COLLATE statement.
edwardneal
commented
Mar 15, 2026
edwardneal
commented
Mar 15, 2026
edwardneal
commented
Mar 15, 2026
Contributor
|
/azp run |
|
Azure Pipelines successfully started running 2 pipeline(s). |
paulmedynski
approved these changes
Mar 25, 2026
Codecov Report✅ All modified and coverable lines are covered by tests.
Additional details and impacted files@@ Coverage Diff @@
## main #4051 +/- ##
==========================================
- Coverage 74.62% 65.56% -9.07%
==========================================
Files 280 274 -6
Lines 43814 66778 +22964
==========================================
+ Hits 32698 43785 +11087
- Misses 11116 22993 +11877
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:
|
cheenamalhotra
approved these changes
Apr 8, 2026
Member
cheenamalhotra
left a comment
There was a problem hiding this comment.
Very important test for encoding validation. Thanks!
This file contains hidden or 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
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.
Description
This PR replaces one test and introduces another.
CollatedDataReaderTestPreviously, CollatedDataReaderTest would create a brand new database with one of two collations (Kazakh_90_CI_AI and Georgian_Modern_Sort_CI_AS), then try to select an ASCII string from it. This had a few issues:
I've replaced this with something a little more robust. We now test every collation on a SQL instance, retrieving the character string and its byte representation, then we make sure that they roundtrip. It also uses a string containing the
écharacter; this isn't present in Kazakh_90_CI_AI's code page, so SQL Server converts it toe. This is legitimate behaviour which would otherwise have failed.CollatedStringInOutputParameter_DecodesSuccessfullyThis is a new test which proves that we can roundtrip non-ASCII characters in output parameters when the value's collation's code page represents these non-ASCII characters differently: the default English Windows code page represents
éas0xE9; code page 936 represents this as[0xA8, 0xA6]; and UTF8 represents this as[0xC3, 0xA9].Issues
Loosely related: #584 originally added the CollatedDataReaderTest test, and referred to making sure that the driver would maintain the collation/codepage mappings. These two tests provide sufficient test coverage for that effort (which would also unblock globalization invariant mode.)
Testing
New tests run, the other tests and code remain untouched.