Skip to content

Commit

Permalink
test (#1)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
15 people authored Jul 22, 2024
1 parent 8cbb8b9 commit 95747be
Show file tree
Hide file tree
Showing 135 changed files with 8,627 additions and 6,416 deletions.
2 changes: 1 addition & 1 deletion .config/PolicheckExclusions.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<PoliCheckExclusions>
<Exclusion Type="FolderPathStart">SRC/MICROSOFT.DATA.SQLCLIENT/TESTS</Exclusion>
<Exclusion Type="FileType">.YML|.MD|.SQL</Exclusion>
<Exclusion Type="FileName">NOTICE.TXT</Exclusion>
<Exclusion Type="FileName">NOTICE.TXT|SQLDATAADAPTER.CS</Exclusion>
</PoliCheckExclusions>
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,24 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)

## [Stable release 5.2.1] - 2024-05-31

This update brings the below changes over the previous release:

### Changed

- Upgraded `Azure.Identity` version from 1.10.3 to 1.11.3 [#2492](https://github.com/dotnet/SqlClient/pull/2492), [#2528](https://github.com/dotnet/SqlClient/pull/2528)
- Upgraded `Microsoft.Identity.Client` version from 4.56.0 to 4.60.3 [#2492](https://github.com/dotnet/SqlClient/pull/2492)
- Code Health improvements: [#2467](https://github.com/dotnet/SqlClient/pull/2467)

### Fixed

- Fixed connection errors on Linux when Data Source property contains both named instance and port [#2436](https://github.com/dotnet/SqlClient/pull/2436)
- Fixed `SqlConnection.FireInfoMessageEventOnUserErrors` when set to true throws an exception [#2505](https://github.com/dotnet/SqlClient/pull/2505)
- Fixed exception when using `DATETIMEOFFSET(n)` in a TVP if `n` is 1, 2, 3, or 4 [#2506](https://github.com/dotnet/SqlClient/pull/2506)
- Reverted PR [#1983](https://github.com/dotnet/SqlClient/pull/1938) which caused connection failure delays when using `OpenAsync` [#2507](https://github.com/dotnet/SqlClient/pull/2507)
- Fixed `SqlConnection.Clone()` to include `AccessTokenCallback` [#2527](https://github.com/dotnet/SqlClient/pull/2527)

## [Stable release 5.2.0] - 2024-02-28

### Added
Expand Down
11 changes: 7 additions & 4 deletions build.proj
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
<Import Project="$(ToolsDir)targets\add-ons\GenerateAKVProviderNugetPackage.targets" />

<PropertyGroup>
<!-- SourceLink variable-->
<DisableSourceLink>false</DisableSourceLink>

<RestoreConfigFile>src\NuGet.config</RestoreConfigFile>
<Configuration Condition="'$(Configuration)' == ''">Debug</Configuration>
<Platform Condition="'$(Platform)' == ''">AnyCPU</Platform>
Expand Down Expand Up @@ -177,16 +180,16 @@
<Target Name="RunTests" DependsOnTargets="RunFunctionalTests;RunManualTests"/>
<Target Name="RunFunctionalTests">
<!-- Windows -->
<Exec ConsoleToMsBuild="true" Command="$(DotnetPath)dotnet test &quot;@(FunctionalTestsProj)&quot; -p:Configuration=$(Configuration) -p:Target$(TFGroup)Version=$(TF) --no-build -v n --collect &quot;Code coverage&quot; -p:TestSet=$(TestSet) --results-directory $(ResultsDirectory) -p:TestTargetOS=Windows$(TargetGroup) --filter &quot;category!=non$(TargetGroup)tests&amp;category!=failing&amp;category!=nonwindowstests&quot; &quot;--logger:trx;LogFilePrefix=Functional-Windows$(TargetGroup)-$(TestSet)&quot;" Condition="'$(IsEnabledWindows)' == 'true'"/>
<Exec ConsoleToMsBuild="true" Command="$(DotnetPath)dotnet test &quot;@(FunctionalTestsProj)&quot; -p:Configuration=$(Configuration) -p:Target$(TFGroup)Version=$(TF) -p:ReferenceType=$(ReferenceType) --no-build -v n --collect &quot;Code coverage&quot; -p:TestSet=$(TestSet) --results-directory $(ResultsDirectory) -p:TestTargetOS=Windows$(TargetGroup) --filter &quot;category!=non$(TargetGroup)tests&amp;category!=failing&amp;category!=nonwindowstests&quot; &quot;--logger:trx;LogFilePrefix=Functional-Windows$(TargetGroup)-$(TestSet)&quot;" Condition="'$(IsEnabledWindows)' == 'true'"/>
<!-- Unix -->
<Exec ConsoleToMsBuild="true" Command="$(DotnetPath)dotnet test &quot;@(FunctionalTestsProj)&quot; -p:Configuration=$(Configuration) -p:TargetNetCoreVersion=$(TF) --no-build -v n -p:TestSet=$(TestSet) --results-directory $(ResultsDirectory) -p:TestTargetOS=Unixnetcoreapp --collect &quot;Code coverage&quot; --filter &quot;category!=nonnetcoreapptests&amp;category!=failing&amp;category!=nonlinuxtests&amp;category!=nonuaptests&quot; &quot;--logger:trx;LogFilePrefix=Functional-Unixnetcoreapp-$(TestSet)&quot;" Condition="'$(IsEnabledWindows)' != 'true'"/>
<Exec ConsoleToMsBuild="true" Command="$(DotnetPath)dotnet test &quot;@(FunctionalTestsProj)&quot; -p:Configuration=$(Configuration) -p:TargetNetCoreVersion=$(TF) -p:ReferenceType=$(ReferenceType) --no-build -v n -p:TestSet=$(TestSet) --results-directory $(ResultsDirectory) -p:TestTargetOS=Unixnetcoreapp --collect &quot;Code coverage&quot; --filter &quot;category!=nonnetcoreapptests&amp;category!=failing&amp;category!=nonlinuxtests&amp;category!=nonuaptests&quot; &quot;--logger:trx;LogFilePrefix=Functional-Unixnetcoreapp-$(TestSet)&quot;" Condition="'$(IsEnabledWindows)' != 'true'"/>
</Target>

<Target Name="RunManualTests">
<!-- Windows -->
<Exec ConsoleToMsBuild="true" Command="$(DotnetPath)dotnet test &quot;@(ManualTestsProj)&quot; -p:Configuration=$(Configuration) -p:Target$(TFGroup)Version=$(TF) --no-build -l &quot;console;verbosity=normal&quot; --collect &quot;Code coverage&quot; -p:TestSet=$(TestSet) --results-directory $(ResultsDirectory) -p:TestTargetOS=Windows$(TargetGroup) --filter &quot;category!=non$(TargetGroup)tests&amp;category!=failing&amp;category!=nonwindowstests&quot; &quot;--logger:trx;LogFilePrefix=Manual-Windows$(TargetGroup)-$(TestSet)&quot;" Condition="'$(IsEnabledWindows)' == 'true'"/>
<Exec ConsoleToMsBuild="true" Command="$(DotnetPath)dotnet test &quot;@(ManualTestsProj)&quot; -p:Configuration=$(Configuration) -p:Target$(TFGroup)Version=$(TF) -p:ReferenceType=$(ReferenceType) --no-build -l &quot;console;verbosity=normal&quot; --collect &quot;Code coverage&quot; -p:TestSet=$(TestSet) --results-directory $(ResultsDirectory) -p:TestTargetOS=Windows$(TargetGroup) --filter &quot;category!=non$(TargetGroup)tests&amp;category!=failing&amp;category!=nonwindowstests&quot; &quot;--logger:trx;LogFilePrefix=Manual-Windows$(TargetGroup)-$(TestSet)&quot;" Condition="'$(IsEnabledWindows)' == 'true'"/>
<!-- Unix -->
<Exec ConsoleToMsBuild="true" Command="$(DotnetPath)dotnet test &quot;@(ManualTestsProj)&quot; -p:Configuration=$(Configuration) -p:TargetNetCoreVersion=$(TF) --no-build -l &quot;console;verbosity=normal&quot; --collect &quot;Code coverage&quot; -p:TestSet=$(TestSet) --results-directory $(ResultsDirectory) -p:TestTargetOS=Unixnetcoreapp --filter &quot;category!=nonnetcoreapptests&amp;category!=failing&amp;category!=nonlinuxtests&amp;category!=nonuaptests&quot; &quot;--logger:trx;LogFilePrefix=Manual-Unixnetcoreapp-$(TestSet)&quot;" Condition="'$(IsEnabledWindows)' != 'true'"/>
<Exec ConsoleToMsBuild="true" Command="$(DotnetPath)dotnet test &quot;@(ManualTestsProj)&quot; -p:Configuration=$(Configuration) -p:TargetNetCoreVersion=$(TF) -p:ReferenceType=$(ReferenceType) --no-build -l &quot;console;verbosity=normal&quot; --collect &quot;Code coverage&quot; -p:TestSet=$(TestSet) --results-directory $(ResultsDirectory) -p:TestTargetOS=Unixnetcoreapp --filter &quot;category!=nonnetcoreapptests&amp;category!=failing&amp;category!=nonlinuxtests&amp;category!=nonuaptests&quot; &quot;--logger:trx;LogFilePrefix=Manual-Unixnetcoreapp-$(TestSet)&quot;" Condition="'$(IsEnabledWindows)' != 'true'"/>
</Target>

<Target Name="Clean">
Expand Down
15 changes: 11 additions & 4 deletions doc/samples/SqlConnection_AccessTokenCallback.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,21 @@ static void Main()

private static void OpenSqlConnection()
{
const string defaultScopeSuffix = "/.default";
string connectionString = GetConnectionString();
using (SqlConnection connection = new SqlConnection("Data Source=contoso.database.windows.net;Initial Catalog=AdventureWorks;")
DefaultAzureCredential credential = new();

using (SqlConnection connection = new(connectionString)
{
AccessTokenCallback = async (authParams, cancellationToken) =>
{
var cred = new DefaultAzureCredential();
string scope = authParams.Resource.EndsWith(s_defaultScopeSuffix) ? authParams.Resource : authParams.Resource + s_defaultScopeSuffix;
var token = await cred.GetTokenAsync(new TokenRequestContext(new[] { scope }), cancellationToken);
string scope = authParams.Resource.EndsWith(defaultScopeSuffix)
? authParams.Resource
: $"{authParams.Resource}{defaultScopeSuffix}";
AccessToken token = await credential.GetTokenAsync(
new TokenRequestContext([scope]),
cancellationToken);
return new SqlAuthenticationToken(token.Token, token.ExpiresOn);
}
})
Expand Down
Loading

0 comments on commit 95747be

Please sign in to comment.