-
Notifications
You must be signed in to change notification settings - Fork 281
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
Change | Separate tests for NetFx and NetCore - NetFx-Only Connection String Properties #2466
Change | Separate tests for NetFx and NetCore - NetFx-Only Connection String Properties #2466
Conversation
…orm connection string error messages Splitting unit test for netfx-only connection string properties such that test does not fail on netcore
@@ -912,17 +911,19 @@ public override StandardValuesCollection GetStandardValues(ITypeDescriptorContex | |||
} | |||
} | |||
#else | |||
private static readonly string[] s_notSupportedKeywords = new string[DeprecatedKeywordsCount] { | |||
private static readonly string[] s_notSupportedKeywords = { |
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.
Array initialization is always the same size as the number of elements, so its unnecessary to specify it.
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.
Since you are eliminating the DeprecatedKeywordsCount reference here, you should just get rid of DeprecatedKeywordsCount entirely and just reference the size of this array in the one other place it's used. Otherwise, DeprecatedKeywordsCount needs to be changed from 3 to 5.
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.
@David-Engel Ok, I've updated the PR, chaning DeprecatedKeywordsCount
to 5 and removing DeprecatedSynonymsCount
from SqlConnectionString
. As far as I can tell, I can't access s_notSupportedKeywords
array from SqlConnectionString
, so I think it makes more sense to just change the number.
As far as I can tell, the only reason for calculating the count is to determine the optimum size of the dictionary. net8 added support for a FrozenDictionary
that has its size fixed at initialization, but it looks like we can't utilize that today. That'd be a nice option here...
Please let me know if this isn't what you had in mind.
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.
I wasn't considering DeprecatedSynonymCount, just DeprecatedKeywordsCount. Just make sure the count is correct in the debug assert at line 927/928 of SqlConnectionString.cs after your changes. I'm pretty sure it's there to ensure we are initializing the Dictionary to the correct size to maximize perf. An incorrect count won't show up at runtime or in tests.
Debug.Assert(synonyms.Count == count, "incorrect initial ParseSynonyms size");
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.
Right. It sounds like we're on the same page, then.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2466 +/- ##
==========================================
- Coverage 72.80% 72.68% -0.13%
==========================================
Files 311 313 +2
Lines 61709 61741 +32
==========================================
- Hits 44928 44875 -53
- Misses 16781 16866 +85
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.
Approved with the minor comment.
@@ -912,17 +911,19 @@ public override StandardValuesCollection GetStandardValues(ITypeDescriptorContex | |||
} | |||
} | |||
#else | |||
private static readonly string[] s_notSupportedKeywords = new string[DeprecatedKeywordsCount] { | |||
private static readonly string[] s_notSupportedKeywords = { |
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.
Since you are eliminating the DeprecatedKeywordsCount reference here, you should just get rid of DeprecatedKeywordsCount entirely and just reference the size of this array in the one other place it's used. Otherwise, DeprecatedKeywordsCount needs to be changed from 3 to 5.
* Updating Azure.Identity version to 1.11.3 (dotnet#2526) * Fix | Clone of SqlConnection should include AccessTokenCallback (dotnet#2525) * Enhancement | Add trace logs for packet size (dotnet#2522) * Merged PR 4583: eng | Fix policheck errors. Fix policheck errors. Sample pipeline run which did not have policheck errors: https://sqlclientdrivers.visualstudio.com/ADO.Net/_build/results?buildId=88114&view=sariftools.scans.build-tab Related work items: #30279 * Doc | Fix SNI dependencies of 5.1 and 5.2 release notes (dotnet#2537) * Change | Separate tests for NetFx and NetCore - NetFx-Only Connection String Properties (dotnet#2466) * Adding TransparentNetworkIpResolution to list of unsupported on platform connection string error messages Splitting unit test for netfx-only connection string properties such that test does not fail on netcore * Remove DeprecatedSynonymCount since referencing the unsupported array is not possible * Fix | Enhance certificate validation (dotnet#2487) * Hotfix v5.2.1 Release notes (dotnet#2534) * Improve AccessTokenCallback sample code (dotnet#2543) * Merged PR 4621: eng | Fix policheck * Fix | Adjust path for .AssemblyAttributes in obj folder (dotnet#2550) * Fix | Fixed GenerateSspiClientContext to retry negotiation with default port (dotnet#2559) * Strong typed diagnostics (dotnet#2226) * Fix | Replaced System.Runtime.Caching with Microsoft.Extensions.Caching.Memory (dotnet#2493) * Add | Add SourceLink translation (dotnet#2552) * Add | Cache TokenCredential objects to take advantage of token caching (dotnet#2380) * Merged common code base for SqlUtil.cs (dotnet#2533) * Add scope trace for GenerateSspiClientContext (dotnet#2497) * Address conflicts (dotnet#2562) * Addressing conflict (dotnet#2560) * Merge SqlColumnEncryptionCertificateStoreProvider (dotnet#2521) * Add | No-op if engineedition is 6 or 11 due to lack of support for ASSEMBLYPROPERTY function (dotnet#2593) * Change | Remove some unneeded references and update Azure.Identity (dotnet#2577) * Add test for issue 2456 (dotnet#2457) * Merged common code base for AlwaysEncryptedKeyConverter (dotnet#2538) * Merged AlwaysEncryptedKeyConverter.CrossPlatform and AlwaysEncryptedKeyConverter.Cng. * 3 Small Changes (dotnet#2594) * * Port sqlclientx datasource changes * Remove link to missing nuget.config file * Remove root namespaces from sqlclient csproj files * Test to see if namespace changes are breaking the pr build * Reinstate removing the root namespace and fix resource filename generation * Test fixes to accommodate recent infra changes (dotnet#2646) * Test fixes to accomodate recent infra changes * Fix - Don't error when using infinte connect timeout and Entra auth (dotnet#2651) * eng | Add delay signed to official builds (dotnet#2653) * eng | Initial YAML CI pipeline (dotnet#2575) * Fix | Fix decrypt failure to drain data (dotnet#2618) * [Scheduled Run] Localized resource files from OneLocBuild * eng | Add Delay sign to ref csprojs (dotnet#2684) * [Scheduled Run] Localized resource files from OneLocBuild * [Scheduled Run] Localized resource files from OneLocBuild --------- Co-authored-by: Javad Rahnama <v-jarahn@microsoft.com> Co-authored-by: David Engel <v-davidengel@microsoft.com> Co-authored-by: Aris Rellegue <v-arellegue@microsoft.com> Co-authored-by: DavoudEshtehari <61173489+DavoudEshtehari@users.noreply.github.com> Co-authored-by: Benjamin Russell <russellben@microsoft.com> Co-authored-by: Aris Rellegue <134557572+arellegue@users.noreply.github.com> Co-authored-by: dauinsight <145612907+dauinsight@users.noreply.github.com> Co-authored-by: Scott Addie <10702007+scottaddie@users.noreply.github.com> Co-authored-by: Daniel Au <v-audaniel@microsoft.com> Co-authored-by: Wraith <wraith2@gmail.com> Co-authored-by: SqlClient Azure DevOps <sqlclient@microsoft.com> Co-authored-by: Edward Neal <55035479+edwardneal@users.noreply.github.com> Co-authored-by: Erik Ejlskov Jensen <ErikEJ@users.noreply.github.com> Co-authored-by: David Engel <davidengel@microsoft.com>
Description: In an effort to make running all unit tests in vs not throw "correct" test failures, this PR creates two tests.
SqlConnectionStringBuilderTest.ConnectionStringTestsNetFx_OnNetCore_Throws
SqlConnectionStringBuilderTest.ConnectionStringTestsNetFx_OnNetFx_Success
As a side effect of this, I had to add
Transparent Network IP Resolution
to the list of properties that will return a "not supported on this platform" exception. This might be considered a breaking change since it changes an exception type, but I see it more as a fix, since it's true - that property is not supported on netcore (yet?) and that exception should be returned.Tests: