Finish sqlclient-stress pipeline#4198
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates the stress-test Azure DevOps pipeline resource configuration and adjusts Managed SNI SPN generation so named-instance connections without a protocol prefix use the SSRP-resolved port (with added unit test coverage).
Changes:
- Update Managed SNI SPN postfix selection to use SSRP-resolved port for non-NP protocols when connecting to named instances (incl.
Protocol.None/admin:). - Add unit tests covering SPN generation for
Protocol.None,tcp:,np:,admin:, and customServerSPN. - Fix the stress pipeline resource
sourcepath for the ADO.Net “MDS Main CI” pipeline.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
src/Microsoft.Data.SqlClient/tests/UnitTests/Microsoft/Data/SqlClient/ManagedSni/SniProxyGetSqlServerSPNsTest.cs |
Adds regression/unit tests for SPN construction across protocols and custom SPN override. |
src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/ManagedSni/SniProxy.netcore.cs |
Adjusts SPN postfix logic to prefer SSRP-resolved port for non-NP named-instance connections; exposes helpers for unit testing. |
eng/pipelines/stress/stress-tests-pipeline.yml |
Updates the referenced ADO.Net pipeline folder/name for the stress pipeline resource trigger. |
Codecov Report✅ All modified and coverable lines are covered by tests.
Additional details and impacted files@@ Coverage Diff @@
## main #4198 +/- ##
==========================================
- Coverage 73.62% 64.42% -9.21%
==========================================
Files 277 272 -5
Lines 42988 65783 +22795
==========================================
+ Hits 31650 42379 +10729
- Misses 11338 23404 +12066
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:
|
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.
Comments suppressed due to low confidence (1)
eng/pipelines/stress/stress-tests-job.yml:100
dotnetArtifactsDiris still defined but is no longer used after removing--artifacts-path $(dotnetArtifactsDir)fromdotnetArguments. Either remove this variable or reintroduce its usage so the job definition stays minimal and avoids confusion about where build outputs are expected.
# The directory where dotnet artifacts will be staged. Not to be
# confused with pipeline artifacts.
- name: dotnetArtifactsDir
value: $(Build.StagingDirectory)/dotnetArtifacts
- Import 'ADO Test Configuration Properties' variable group so the configure-sql-server-win-step template gets x64AliasRegistryPath and other SQL alias variables it expects. - Align stress test TargetFrameworks with SqlClient's shipped TFMs (net8.0;net9.0) to avoid assembly version mismatches when running net8.0 tests built with the .NET 10 SDK. - Add NuGetAuthenticate@1 step before the build so hosted pool agents (macOS) can fetch upstream packages through the ADO Artifacts feed.
- Move 'ADO Test Configuration Properties' variable group from stage to job template so it is not shadowed by the job's own variables block. - Remove --artifacts-path from dotnet CLI arguments to avoid MSB3277 warnings caused by SqlClient's custom OutputPath colliding across TFMs.
- Add 'ADO Build properties' group which provides x64AliasRegistryPath, x86AliasRegistryPath, SQLAliasName, and SQLAliasPort needed by the Windows SQL Server configuration step template. - Fix 'ADO Test Configuration Properties' -> 'ADO Test Configuration properties' (lowercase 'p') to match the actual group name in ADO.
Remove PrivateAssets=All and IncludeAssets from the Microsoft.Data.SqlClient.SNI PackageReference in the main SqlClient csproj so the native SNI DLL flows transitively through ProjectReference. This eliminates the need for every test project to carry its own explicit SNI PackageReference. Remove the now-unnecessary SNI PackageReferences from UnitTests, ManualTests, and FunctionalTests csproj files.
4df9022 to
7bf66ef
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.
Comments suppressed due to low confidence (1)
eng/pipelines/stress/stress-tests-job.yml:103
dotnetArtifactsDiris now unused because--artifacts-path $(dotnetArtifactsDir)was removed fromdotnetArguments. Either removedotnetArtifactsDir(and related comment) to avoid confusion, or reintroduce the argument if artifacts staging is still required by downstream steps.
# The directory where dotnet artifacts will be staged. Not to be
# confused with pipeline artifacts.
- name: dotnetArtifactsDir
value: $(Build.StagingDirectory)/dotnetArtifacts
Add name to the build step and condition test steps with succeededOrFailed() gated on the build step's success. This ensures: - All test runtimes run even if a prior runtime fails - Test steps are skipped if the build or setup fails - Any test failure still fails the overall job
9d5a7b1 to
c02833c
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.
Comments suppressed due to low confidence (1)
eng/pipelines/stress/stress-tests-job.yml:103
dotnetArtifactsDiris still defined, but--artifacts-path $(dotnetArtifactsDir)was removed fromdotnetArguments, so this variable is now unused. Consider either removingdotnetArtifactsDir(and the related comment) or reintroducing the argument if staging build outputs is still required for troubleshooting/artifact collection.
# The directory where dotnet artifacts will be staged. Not to be
# confused with pipeline artifacts.
- name: dotnetArtifactsDir
value: $(Build.StagingDirectory)/dotnetArtifacts
- Replace verbose IncludeAssets with ExcludeAssets="compile" on all PackageReferences that only needed to exclude compile-time assets. - Remove PrivateAssets="all" from SNI refs (ref/, notsupported/, src/) so the native DLL flows transitively via ProjectReference. The nuspec remains the authority for NuGet package consumers. - Remove PrivateAssets="all" from xunit runner refs in test projects since no project references the test projects. - Remove unused dotnetArtifactsDir variable from stress-tests-job.yml. - Fix variable group casing (ADO Build/Test Configuration Properties).
Add a top-level failOnTestFailure parameter (default: false) threaded through pipeline, stage, and job templates. When false, test failures produce warnings (SucceededWithIssues) instead of failing the pipeline. When true, test failures fail the job. Document the interaction between condition, buildSucceeded flag, and continueOnError in the job template.
|
|
||
| <PackageReference Include="Microsoft.Bcl.Cryptography" /> | ||
| <PackageReference Include="Microsoft.Data.SqlClient.SNI" | ||
| PrivateAssets="all" |
There was a problem hiding this comment.
The PrivateAssets=all is the root cause of our test projects failing to find the SNI DLLs when building in Project ref mode. Eureka!
So I removed them all to avoid wondering why some projects have them and others don't.
| <PackageReference Include="Microsoft.Data.SqlClient.SNI" | ||
| PrivateAssets="all" | ||
| IncludeAssets="runtime;build;native;contentfiles;analyzers;buildtransitive" /> | ||
| <PackageReference Include="Microsoft.Data.SqlClient.SNI" ExcludeAssets="compile" /> |
There was a problem hiding this comment.
It's much clearer to Exclude compile than to Include everything else.
|
|
||
| <PackageReference Include="Azure.Identity" /> | ||
| <PackageReference Include="Microsoft.Bcl.Cryptography" /> | ||
| <PackageReference Include="Microsoft.Data.SqlClient.SNI" |
There was a problem hiding this comment.
We don't need these in any of our downstream (i.e. test) projects now.
| <PackageReference Include="System.Runtime.InteropServices.RuntimeInformation" /> | ||
| <PackageReference Include="System.Security.Cryptography.Pkcs" /> | ||
| <PackageReference Include="xunit" /> | ||
| <PackageReference Include="xunit.runner.console" |
There was a problem hiding this comment.
I cleaned up the xUnit references as well, for consistency.
| <PackageReference Include="Microsoft.Data.SqlClient.SNI" | ||
| PrivateAssets="all" | ||
| IncludeAssets="runtime;build;native;contentfiles;analyzers;buildtransitive" /> | ||
| <PackageReference Include="Microsoft.Data.SqlClient.SNI" ExcludeAssets="compile" /> |
There was a problem hiding this comment.
It would be nice to see a comparison of what's included in the nuget package with and without this change to understand the exact effects.
There was a problem hiding this comment.
The change to the project file should have no effect on the NuGet package because we use an explicit nuspec file that already listed SNI as a dependency.
When nuget pack runs, it uses the explicit nuspec file, not the project file metadata. So the change to remove PrivateAssets=All from the .csproj:
✅ Does affect:
- How the SqlClient project itself compiles and builds (the project metadata includes SNI now).
- How transitive dependencies flow to projects that directly reference the project (like the test projects in the repo).
- Simplifies test project configuration by eliminating redundant SNI references.
❌ Does NOT affect:
- The shipped NuGet package metadata.
- What consumers see when they install
Microsoft.Data.SqlClientfrom NuGet. - The declared dependencies in the package.
There was a problem hiding this comment.
Attached package comparison report.
Summary:
- Package identities match (Microsoft.Data.SqlClient 7.1.0-preview1-dev).
- No dependency differences.
- No non-metadata payload differences.
- Differences are metadata-only:
- package/services/metadata/core-properties/*.psmdcp filename differs
- _rels/.rels differs accordingly
Full report
NuGet Package Diff Report
Generated (UTC): 2026-04-29 11:09:09Z
Package A: packages\Microsoft.Data.SqlClient.7.1.0-preview1-dev.no-sni-private-assets.nupkg
Package B: packages\Microsoft.Data.SqlClient.7.1.0-preview1-dev.sni-private-assets.nupkg
== Identity ==
A: Microsoft.Data.SqlClient 7.1.0-preview1-dev
B: Microsoft.Data.SqlClient 7.1.0-preview1-dev
== File Set Diff ==
Only in A: package\services\metadata\core-properties\84b9ed528d5c42b9bc58abad9f7350b2.psmdcp
Only in B: package\services\metadata\core-properties\a3351c01288e498fa28a372e7aeb47ae.psmdcp
== Dependency Diff ==
None
== Shared File Content Diff (all) ==
Changed: _rels\\.rels
== Shared File Content Diff (excluding NuGet metadata paths) ==
None
== Conclusion ==
Payload and dependencies are equivalent; differences are metadata-only.
| <!-- Target all frameworks that MDS supports. --> | ||
| <TargetFrameworks>net8.0;net9.0;net10.0</TargetFrameworks> | ||
| <!-- Target the same frameworks that MDS ships (net8.0, net9.0, plus net462 on Windows). --> | ||
| <TargetFrameworks>net8.0;net9.0</TargetFrameworks> |
There was a problem hiding this comment.
New .NET versions can change environment management in ways that might affect us (e.g. thread pooling). It feels valuable to test in all available versions.
There was a problem hiding this comment.
I've added .NET 10 back. This now mirrors the other SqlClient tests, but note that none of our pipelines actually run any tests with the .NET 10 runtime yet.
Description
Now that the sqlclient-stress pipeline has been defined in the Public project, we can actually see it running based on the new YAML files. This PR works through issues until the stress tests run properly.
Changes
Pipeline fixes
stress-tests-pipeline.ymlafter it was moved.--artifacts-pathfrom dotnet arguments, addedADO Build Propertiesvariable group, fixed variable group casing.condition: succeededOrFailed()gated on abuildSucceededflag so all runtimes are tested even if one fails, but tests are skipped if the build/setup fails. The overall job still reports failure.dotnetArtifactsDirvariable from stress-tests-job.yml.SNI native DLL transitive flow
PrivateAssets=AllfromMicrosoft.Data.SqlClient.SNIin the main SqlClient csproj so the native SNI DLL flows transitively viaProjectReference. This eliminates the need for every test project to carry its own explicit SNIPackageReference(the stress tests were missing them, causingDllNotFoundExceptionon net462).PackageReferenceentries from UnitTests, ManualTests, and FunctionalTests.PackageReference cleanup
IncludeAssetswithExcludeAssets="compile"on all SNI and xunit runner PackageReferences across the codebase. Functionally equivalent but more concise.PrivateAssets="all"from SNI refs in ref/ and notsupported/ projects, and from xunit runner refs in all test projects (no project references the test projects, so it had no effect).Checklist