Skip to content

Commit 8266a5a

Browse files
authored
Finish sqlclient-stress pipeline (#4198)
1 parent be95ca2 commit 8266a5a

10 files changed

Lines changed: 83 additions & 75 deletions

eng/pipelines/stress/stress-tests-job.yml

Lines changed: 41 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,11 @@ parameters:
4848
- name: jobNameSuffix
4949
type: string
5050

51+
# True to fail the job when stress tests fail. When false, test failures produce warnings
52+
# (SucceededWithIssues) but do not fail the job.
53+
- name: failOnTestFailure
54+
type: boolean
55+
5156
# The list of .NET Framework runtimes to test against.
5257
- name: netFrameworkTestRuntimes
5358
type: object
@@ -88,10 +93,13 @@ jobs:
8893

8994
variables:
9095

91-
# The directory where dotnet artifacts will be staged. Not to be
92-
# confused with pipeline artifacts.
93-
- name: dotnetArtifactsDir
94-
value: $(Build.StagingDirectory)/dotnetArtifacts
96+
# Import the variable group that provides SQL Server build properties used by the
97+
# shared configure-sql-server-*-step.yml templates (e.g. x64AliasRegistryPath,
98+
# x86AliasRegistryPath, SQLAliasName, SQLAliasPort).
99+
- group: ADO Build Properties
100+
101+
# Import the variable group that provides SQL Server test configuration variables.
102+
- group: ADO Test Configuration Properties
95103

96104
# The top-level project file to build and run.
97105
- name: project
@@ -101,7 +109,6 @@ jobs:
101109
- name: dotnetArguments
102110
value: >-
103111
--verbosity ${{ parameters.dotnetVerbosity }}
104-
--artifacts-path $(dotnetArtifactsDir)
105112
--configuration ${{ parameters.buildConfiguration }}
106113
107114
# The contents of the config file to use for all tests. We will write this to a JSON file and
@@ -153,6 +160,12 @@ jobs:
153160
# Write the JSON content to the config file.
154161
$content | Out-File -FilePath "config.json"
155162
163+
# Authenticate with NuGet feeds so that upstream packages (e.g. runtime host packs) can be
164+
# fetched through the ADO Artifacts feed. This is required on hosted pool agents (macOS)
165+
# that do not have pre-configured feed credentials.
166+
- task: NuGetAuthenticate@1
167+
displayName: Authenticate NuGet feeds
168+
156169
# Build the project.
157170
- task: DotNetCoreCLI@2
158171
displayName: Build Project
@@ -161,10 +174,31 @@ jobs:
161174
projects: $(project)
162175
arguments: $(dotnetArguments)
163176

177+
# Set a flag so test steps can distinguish a build failure from a test failure.
178+
- pwsh: Write-Host "##vso[task.setvariable variable=buildSucceeded]true"
179+
displayName: Set build success flag
180+
164181
# Run the stress tests for each .NET runtime.
182+
#
183+
# The condition and continueOnError work together to achieve the following behavior:
184+
#
185+
# condition: and(succeededOrFailed(), eq(variables['buildSucceeded'], 'true'))
186+
# - succeededOrFailed() allows the step to run even if a *previous test* step failed,
187+
# ensuring all runtimes are exercised regardless of earlier failures.
188+
# - eq(variables['buildSucceeded'], 'true') gates on the flag set above, so tests are
189+
# skipped entirely if the build or any setup step failed (since there's nothing to run).
190+
#
191+
# continueOnError: ${{ not(parameters.failOnTestFailure) }}
192+
# - When failOnTestFailure is false, continueOnError is true: a test failure marks the
193+
# step and job as SucceededWithIssues (orange warning) rather than Failed.
194+
# - When failOnTestFailure is true, continueOnError is false: a test failure fails the
195+
# job (red), though subsequent runtimes still run due to the condition above.
196+
#
165197
- ${{ each runtime in parameters.netTestRuntimes }}:
166198
- task: DotNetCoreCLI@2
167199
displayName: Test [${{ runtime }}]
200+
condition: and(succeededOrFailed(), eq(variables['buildSucceeded'], 'true'))
201+
continueOnError: ${{ not(parameters.failOnTestFailure) }}
168202
inputs:
169203
command: run
170204
projects: $(project)
@@ -174,6 +208,8 @@ jobs:
174208
- ${{ each runtime in parameters.netFrameworkTestRuntimes }}:
175209
- task: DotNetCoreCLI@2
176210
displayName: Test [${{ runtime }}]
211+
condition: and(succeededOrFailed(), eq(variables['buildSucceeded'], 'true'))
212+
continueOnError: ${{ not(parameters.failOnTestFailure) }}
177213
inputs:
178214
command: run
179215
projects: $(project)

eng/pipelines/stress/stress-tests-pipeline.yml

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@
88
#
99
# Public project:
1010
# Triggering pipelines: PR-SqlClient-Project, CI-SqlClient (branch main only)
11-
# Pipeline name: Stress-SqlClient
12-
# Pipeline URL: TODO: Create the Azure DevOps pipeline.
11+
# Pipeline name: sqlclient-stress
12+
# Pipeline URL: https://sqlclientdrivers.visualstudio.com/public/_build?definitionId=2250
1313
#
1414
# ADO.Net project:
1515
# Triggering pipeline: MDS Main CI (branch internal/main only)
16-
# Pipeline name: Stress-SqlClient
17-
# Pipeline URL: TODO: Create the Azure DevOps pipeline.
16+
# Pipeline name: sqlclient-stress
17+
# Pipeline URL: TODO: add URL when pipeline is created
1818

1919
# Set the pipeline run name to the day-of-year and the daily run counter.
2020
name: $(DayOfYear)$(Rev:rr)
@@ -49,7 +49,7 @@ resources:
4949
# The MDS Main CI pipeline in the ADO.Net project.
5050
- pipeline: ADO-Net-Internal-CI-MDS-Main-CI
5151
project: ADO.Net
52-
source: /Internal CI/MDS Main CI
52+
source: /CI/MDS Main CI
5353
trigger:
5454
branches:
5555
include:
@@ -73,6 +73,13 @@ parameters:
7373
type: boolean
7474
default: false
7575

76+
# True to fail the pipeline when stress tests fail. When false (default), test failures produce
77+
# warnings but do not fail the overall pipeline run.
78+
- name: failOnTestFailure
79+
displayName: Fail pipeline on test failure
80+
type: boolean
81+
default: false
82+
7683
# Dotnet CLI verbosity level.
7784
- name: dotnetVerbosity
7885
displayName: dotnet CLI Verbosity
@@ -98,4 +105,5 @@ stages:
98105
parameters:
99106
buildConfiguration: ${{ parameters.buildConfiguration }}
100107
debug: ${{ parameters.debug }}
108+
failOnTestFailure: ${{ parameters.failOnTestFailure }}
101109
dotnetVerbosity: ${{ parameters.dotnetVerbosity }}

eng/pipelines/stress/stress-tests-stage.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ parameters:
3232
type: boolean
3333
default: false
3434

35+
# True to fail the job when stress tests fail. When false, test failures produce warnings.
36+
- name: failOnTestFailure
37+
type: boolean
38+
3539
# The verbosity level for the dotnet CLI commands.
3640
- name: dotnetVerbosity
3741
type: string
@@ -48,10 +52,11 @@ parameters:
4852
type: object
4953
default: [net462]
5054

51-
# The list of .NET runtimes to test against.
55+
# The list of .NET runtimes to test against. These must align with the TargetFrameworks defined
56+
# in the stress test Directory.Build.props and the TFMs that SqlClient ships.
5257
- name: netTestRuntimes
5358
type: object
54-
default: [net8.0, net9.0, net10.0]
59+
default: [net8.0, net9.0]
5560

5661
stages:
5762
- stage: stress_tests_stage
@@ -75,6 +80,7 @@ stages:
7580
debug: ${{ parameters.debug }}
7681
displayNamePrefix: Linux
7782
dotnetVerbosity: ${{ parameters.dotnetVerbosity }}
83+
failOnTestFailure: ${{ parameters.failOnTestFailure }}
7884
jobNameSuffix: linux
7985
netTestRuntimes: ${{ parameters.netTestRuntimes }}
8086
poolName: ADO-CI-1ES-Pool
@@ -94,6 +100,7 @@ stages:
94100
debug: ${{ parameters.debug }}
95101
displayNamePrefix: Win
96102
dotnetVerbosity: ${{ parameters.dotnetVerbosity }}
103+
failOnTestFailure: ${{ parameters.failOnTestFailure }}
97104
jobNameSuffix: windows
98105
# Note that we include the .NET Framework runtimes for test runs on Windows.
99106
netFrameworkTestRuntimes: ${{ parameters.netFrameworkTestRuntimes }}
@@ -117,6 +124,7 @@ stages:
117124
debug: ${{ parameters.debug }}
118125
displayNamePrefix: macOS
119126
dotnetVerbosity: ${{ parameters.dotnetVerbosity }}
127+
failOnTestFailure: ${{ parameters.failOnTestFailure }}
120128
jobNameSuffix: macos
121129
netTestRuntimes: ${{ parameters.netTestRuntimes }}
122130
# We don't have any 1ES Hosted Pool images for macOS, so we use a generic one from Azure

src/Microsoft.Data.SqlClient/notsupported/Microsoft.Data.SqlClient.csproj

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,9 +137,7 @@
137137
<Reference Include="System.Xml" />
138138

139139
<PackageReference Include="Microsoft.Bcl.Cryptography" />
140-
<PackageReference Include="Microsoft.Data.SqlClient.SNI"
141-
PrivateAssets="all"
142-
IncludeAssets="runtime;build;native;contentfiles;analyzers;buildtransitive" />
140+
<PackageReference Include="Microsoft.Data.SqlClient.SNI" ExcludeAssets="compile" />
143141
<PackageReference Include="Microsoft.Extensions.Caching.Memory" />
144142
<PackageReference Include="Microsoft.IdentityModel.JsonWebTokens" />
145143
<PackageReference Include="Microsoft.IdentityModel.Protocols.OpenIdConnect" />

src/Microsoft.Data.SqlClient/ref/Microsoft.Data.SqlClient.csproj

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,7 @@
9393
<Reference Include="System.Xml" />
9494

9595
<PackageReference Include="Microsoft.Bcl.Cryptography" />
96-
<PackageReference Include="Microsoft.Data.SqlClient.SNI"
97-
PrivateAssets="all"
98-
IncludeAssets="runtime;build;native;contentfiles;analyzers;buildtransitive" />
96+
<PackageReference Include="Microsoft.Data.SqlClient.SNI" ExcludeAssets="compile" />
9997
<PackageReference Include="Microsoft.Extensions.Caching.Memory" />
10098
<PackageReference Include="Microsoft.IdentityModel.JsonWebTokens" />
10199
<PackageReference Include="Microsoft.IdentityModel.Protocols.OpenIdConnect" />

src/Microsoft.Data.SqlClient/src/Microsoft.Data.SqlClient.csproj

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -144,10 +144,7 @@
144144
<Reference Include="System.Transactions" />
145145

146146
<PackageReference Include="Microsoft.Bcl.Cryptography" />
147-
<PackageReference Include="Microsoft.Data.SqlClient.SNI">
148-
<PrivateAssets>All</PrivateAssets>
149-
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
150-
</PackageReference>
147+
<PackageReference Include="Microsoft.Data.SqlClient.SNI" ExcludeAssets="compile" />
151148
<PackageReference Include="Microsoft.Extensions.Caching.Memory" />
152149
<PackageReference Include="Microsoft.IdentityModel.JsonWebTokens" />
153150
<PackageReference Include="Microsoft.IdentityModel.Protocols.OpenIdConnect" />

src/Microsoft.Data.SqlClient/tests/FunctionalTests/Microsoft.Data.SqlClient.FunctionalTests.csproj

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,6 @@
6363

6464
<PackageReference Include="Azure.Identity" />
6565
<PackageReference Include="Microsoft.Bcl.Cryptography" />
66-
<PackageReference Include="Microsoft.Data.SqlClient.SNI"
67-
Condition="'$(ReferenceType)' != 'Package'" />
6866
<PackageReference Include="Microsoft.DotNet.XUnitExtensions" />
6967
<PackageReference Include="Microsoft.Extensions.Hosting" />
7068
<PackageReference Include="Microsoft.NET.Test.Sdk" />
@@ -75,12 +73,8 @@
7573
<PackageReference Include="System.Runtime.InteropServices.RuntimeInformation" />
7674
<PackageReference Include="System.Security.Cryptography.Pkcs" />
7775
<PackageReference Include="xunit" />
78-
<PackageReference Include="xunit.runner.console"
79-
IncludeAssets="runtime; build; native; contentfiles; analyzers; buildtransitive"
80-
PrivateAssets="all" />
81-
<PackageReference Include="xunit.runner.visualstudio"
82-
IncludeAssets="runtime; build; native; contentfiles; analyzers; buildtransitive"
83-
PrivateAssets="all" />
76+
<PackageReference Include="xunit.runner.console" ExcludeAssets="compile" />
77+
<PackageReference Include="xunit.runner.visualstudio" ExcludeAssets="compile" />
8478

8579
<ProjectReference Include="$(RepoRoot)src/Microsoft.Data.SqlClient/tests/Common/Microsoft.Data.SqlClient.TestCommon.csproj" />
8680
<ProjectReference Include="$(RepoRoot)src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/UdtTest/UDTs/Address/Address.csproj" />
@@ -94,8 +88,6 @@
9488
<ItemGroup Condition="'$(TargetFramework)' != 'net462'">
9589
<PackageReference Include="Azure.Identity" />
9690
<PackageReference Include="Microsoft.Bcl.Cryptography" />
97-
<PackageReference Include="Microsoft.Data.SqlClient.SNI.runtime"
98-
Condition="'$(ReferenceType)' != 'Package'" />
9991
<PackageReference Include="Microsoft.DotNet.XUnitExtensions" />
10092
<PackageReference Include="Microsoft.Extensions.Hosting" />
10193
<PackageReference Include="Microsoft.NET.Test.Sdk" />
@@ -105,12 +97,8 @@
10597
<PackageReference Include="System.Data.Odbc" />
10698
<PackageReference Include="System.Security.Cryptography.Pkcs" />
10799
<PackageReference Include="xunit" />
108-
<PackageReference Include="xunit.runner.console"
109-
IncludeAssets="runtime; build; native; contentfiles; analyzers; buildtransitive"
110-
PrivateAssets="all" />
111-
<PackageReference Include="xunit.runner.visualstudio"
112-
IncludeAssets="runtime; build; native; contentfiles; analyzers; buildtransitive"
113-
PrivateAssets="all" />
100+
<PackageReference Include="xunit.runner.console" ExcludeAssets="compile" />
101+
<PackageReference Include="xunit.runner.visualstudio" ExcludeAssets="compile" />
114102

115103
<ProjectReference Include="$(RepoRoot)src/Microsoft.Data.SqlClient/tests/Common/Microsoft.Data.SqlClient.TestCommon.csproj" />
116104
<ProjectReference Include="$(RepoRoot)src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/UdtTest/UDTs/Address/Address.csproj" />

src/Microsoft.Data.SqlClient/tests/ManualTests/Microsoft.Data.SqlClient.ManualTests.csproj

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -357,8 +357,6 @@
357357
<PackageReference Include="Microsoft.Bcl.Cryptography" />
358358
<PackageReference Include="System.Memory" />
359359
<PackageReference Include="System.ValueTuple" />
360-
<PackageReference Include="Microsoft.Data.SqlClient.SNI"
361-
Condition="'$(ReferenceType)' != 'Package'" />
362360
<PackageReference Include="Microsoft.DotNet.XUnitExtensions" />
363361
<PackageReference Include="Microsoft.NET.Test.Sdk" />
364362
<PackageReference Include="Microsoft.SqlServer.Types" />
@@ -367,12 +365,8 @@
367365
<PackageReference Include="System.Security.Cryptography.Pkcs" />
368366
<PackageReference Include="System.ServiceProcess.ServiceController" />
369367
<PackageReference Include="xunit" />
370-
<PackageReference Include="xunit.runner.console"
371-
IncludeAssets="runtime; build; native; contentfiles; analyzers; buildtransitive"
372-
PrivateAssets="all" />
373-
<PackageReference Include="xunit.runner.visualstudio"
374-
IncludeAssets="runtime; build; native; contentfiles; analyzers; buildtransitive"
375-
PrivateAssets="all" />
368+
<PackageReference Include="xunit.runner.console" ExcludeAssets="compile" />
369+
<PackageReference Include="xunit.runner.visualstudio" ExcludeAssets="compile" />
376370

377371
<ProjectReference Include="SQL/UdtTest/UDTs/Address/Address.csproj" />
378372
<ProjectReference Include="SQL/UdtTest/UDTs/Circle/Circle.csproj" />
@@ -391,21 +385,15 @@
391385
<ItemGroup Condition="'$(TargetFramework)' != 'net462'">
392386
<PackageReference Include="Azure.Identity" />
393387
<PackageReference Include="Microsoft.Bcl.Cryptography" />
394-
<PackageReference Include="Microsoft.Data.SqlClient.SNI.runtime"
395-
Condition="'$(ReferenceType)' != 'Package'" />
396388
<PackageReference Include="Microsoft.DotNet.XUnitExtensions" />
397389
<PackageReference Include="Microsoft.NET.Test.Sdk" />
398390
<PackageReference Include="Microsoft.SqlServer.Types" />
399391
<PackageReference Include="System.Configuration.ConfigurationManager" />
400392
<PackageReference Include="System.Security.Cryptography.Pkcs" />
401393
<PackageReference Include="System.ServiceProcess.ServiceController" />
402394
<PackageReference Include="xunit" />
403-
<PackageReference Include="xunit.runner.console"
404-
IncludeAssets="runtime; build; native; contentfiles; analyzers; buildtransitive"
405-
PrivateAssets="all" />
406-
<PackageReference Include="xunit.runner.visualstudio"
407-
IncludeAssets="runtime; build; native; contentfiles; analyzers; buildtransitive"
408-
PrivateAssets="all" />
395+
<PackageReference Include="xunit.runner.console" ExcludeAssets="compile" />
396+
<PackageReference Include="xunit.runner.visualstudio" ExcludeAssets="compile" />
409397

410398
<ProjectReference Include="SQL/UdtTest/UDTs/Address/Address.csproj" />
411399
<ProjectReference Include="SQL/UdtTest/UDTs/Circle/Circle.csproj" />

src/Microsoft.Data.SqlClient/tests/StressTests/Directory.Build.props

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,15 @@
1010
<!-- The stress tests root. -->
1111
<StressRoot>$(MSBuildThisFileDirectory)</StressRoot>
1212

13-
<!-- Target all frameworks that MDS supports. -->
13+
<!-- Target the same frameworks that the rest of the SqlClient tests do. -->
1414
<TargetFrameworks>net8.0;net9.0;net10.0</TargetFrameworks>
1515

16-
<!--
17-
We can only build MDS for net462 if we are building for Windows, so we will only build this
18-
for net462 if we are on Windows.
19-
-->
16+
<!-- We can only run .NET Framework tests on Windows, so add net462 if that is the host OS. -->
2017
<TargetFrameworks Condition="'$(OS)' == 'Windows_NT'">$(TargetFrameworks);net462</TargetFrameworks>
2118

2219
<!--
23-
Use the latest C# language version, regardless of what a particular
24-
target framework claims to support.
20+
Use the latest C# language version, regardless of what a particular target framework claims to
21+
support.
2522
-->
2623
<LangVersion>latest</LangVersion>
2724
</PropertyGroup>

src/Microsoft.Data.SqlClient/tests/UnitTests/Microsoft.Data.SqlClient.UnitTests.csproj

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -46,19 +46,14 @@
4646
<ItemGroup Condition="'$(TargetFramework)' == 'net462'">
4747
<Reference Include="System.Transactions" />
4848

49-
<PackageReference Include="Microsoft.Data.SqlClient.SNI" />
5049
<PackageReference Include="Microsoft.DotNet.XUnitExtensions" />
5150
<PackageReference Include="Microsoft.NET.Test.Sdk" />
5251
<PackageReference Include="Microsoft.SqlServer.Server" />
5352
<PackageReference Include="System.Configuration.ConfigurationManager" />
5453
<PackageReference Include="System.Runtime.InteropServices.RuntimeInformation" />
5554
<PackageReference Include="xunit" />
56-
<PackageReference Include="xunit.runner.console"
57-
IncludeAssets="runtime; build; native; contentfiles; analyzers; buildtransitive"
58-
PrivateAssets="all" />
59-
<PackageReference Include="xunit.runner.visualstudio"
60-
IncludeAssets="runtime; build; native; contentfiles; analyzers; buildtransitive"
61-
PrivateAssets="all" />
55+
<PackageReference Include="xunit.runner.console" ExcludeAssets="compile" />
56+
<PackageReference Include="xunit.runner.visualstudio" ExcludeAssets="compile" />
6257

6358
<ProjectReference Include="$(RepoRoot)src\Microsoft.Data.SqlClient\tests\Common\Microsoft.Data.SqlClient.TestCommon.csproj" />
6459
<ProjectReference Include="$(RepoRoot)src\Microsoft.Data.SqlClient\tests\tools\TDS\TDS\TDS.csproj" />
@@ -68,18 +63,13 @@
6863

6964
<!-- References for netcore -->
7065
<ItemGroup Condition="'$(TargetFramework)' != 'net462'">
71-
<PackageReference Include="Microsoft.Data.SqlClient.SNI.runtime" />
7266
<PackageReference Include="Microsoft.DotNet.XUnitExtensions" />
7367
<PackageReference Include="Microsoft.NET.Test.Sdk" />
7468
<PackageReference Include="Microsoft.SqlServer.Server" />
7569
<PackageReference Include="System.Configuration.ConfigurationManager" />
7670
<PackageReference Include="xunit" />
77-
<PackageReference Include="xunit.runner.console"
78-
IncludeAssets="runtime; build; native; contentfiles; analyzers; buildtransitive"
79-
PrivateAssets="all" />
80-
<PackageReference Include="xunit.runner.visualstudio"
81-
IncludeAssets="runtime; build; native; contentfiles; analyzers; buildtransitive"
82-
PrivateAssets="all" />
71+
<PackageReference Include="xunit.runner.console" ExcludeAssets="compile" />
72+
<PackageReference Include="xunit.runner.visualstudio" ExcludeAssets="compile" />
8373

8474
<ProjectReference Include="$(RepoRoot)src\Microsoft.Data.SqlClient\tests\Common\Microsoft.Data.SqlClient.TestCommon.csproj" />
8575
<ProjectReference Include="$(RepoRoot)src\Microsoft.Data.SqlClient\tests\tools\TDS\TDS\TDS.csproj" />

0 commit comments

Comments
 (0)