Skip to content

Commit a68e00f

Browse files
authored
Common | Wire Manual Tests to Common MDS (part 2) (dotnet#3940)
* Cleanup AKV provider project file * Point AKV provider at common MDS project * Point custom retry logic provider at common MDS * Point manual tests against CommonTest and Common MDS projects. * Remove BuildManualTests* build.proj targets - they are no longer necessary * RunManualTests* build.proj targets now build the project and dependencies * Cleanup filter/collect/blame arguments for test targets, ensure test set is only set if provided. * Remove BuildTests* targets from build.proj, remove from pipelines. * Drop build-all-tests-step.yml since it no longer does anything * Remove AKV build from before test execution - it is now built as a dependency for manual tests. * Remove manual tests from the restoretests* targets * Remove RestoreTests* targets as they were doing nothing and not being used anywhere * Someone didn't add their new pipeline files to the solution... tsk tsk 😉 * Remove Common.csproj. Use Microsoft.Data.SqlClient.TestCommon going forward. * Update buildguide * Typos * Make nuget.config.local the nuget.config * Remove nuget.config switches from pipelines
1 parent e94bb69 commit a68e00f

16 files changed

+203
-576
lines changed

BUILDGUIDE.md

Lines changed: 74 additions & 155 deletions
Large diffs are not rendered by default.

NuGet.config

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,23 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<configuration>
33
<packageSources>
4-
54
<!-- Clear all inherited feeds. -->
65
<clear />
76

87
<!--
9-
We do not use the public nuget.org feed. Instead, we use a governed feed maintained by our
10-
SqlClientDrivers ADO organization. Packages must be individually vetted and added to this
8+
We do not use the public nuget.org feed. Instead, we use a governed feed maintained by our
9+
SqlClientDrivers ADO organization. Packages must be individually vetted and added to this
1110
feed manually before they will be available for consumption by our builds.
1211
1312
https://sqlclientdrivers.visualstudio.com/public/_artifacts/feed/sqlclient
1413
-->
1514
<add key="governed" value="https://sqlclientdrivers.pkgs.visualstudio.com/public/_packaging/sqlclient/nuget/v3/index.json" />
1615

16+
<!--
17+
This package source is used by developers and our pipelines builds when we need to reference
18+
packages that are not available on the public nuget.org feed, for example to test MDS that
19+
depends on a version of Abstractions that was just built in the workspace.
20+
-->
21+
<add key="local" value="packages/" />
1722
</packageSources>
1823
</configuration>

NuGet.config.local

Lines changed: 0 additions & 25 deletions
This file was deleted.

build.proj

Lines changed: 53 additions & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,6 @@
1010
<!-- SourceLink variable-->
1111
<DisableSourceLink>false</DisableSourceLink>
1212

13-
<!-- Use the NuGet.config with a local source for Package reference builds. -->
14-
<NuGetConfigFile>$(RepoRoot)/NuGet.config</NuGetConfigFile>
15-
<NuGetConfigFile Condition="'$(ReferenceType)' == 'Package'">$(NuGetConfigFile).local</NuGetConfigFile>
16-
1713
<Configuration Condition="'$(Configuration)' == ''">Debug</Configuration>
1814
<Platform Condition="'$(Platform)' == ''">AnyCPU</Platform>
1915
<!-- Flag to control whether or not to build Microsoft.DotNet.GenAPI project in tools -->
@@ -32,7 +28,7 @@
3228
<TargetNetFxVersion Condition="$(TargetGroup) == 'netfx' AND $(TargetNetFxVersion) == ''">$(TF)</TargetNetFxVersion>
3329
<GenerateNuget Condition="'$(GenerateNuget)' == '' AND '$(IsEnabledWindows)' == 'true'">true</GenerateNuget>
3430

35-
<CommonProperties>Configuration=$(Configuration);ReferenceType=$(ReferenceType);RestoreConfigFile=$(NuGetConfigFile)</CommonProperties>
31+
<CommonProperties>Configuration=$(Configuration);ReferenceType=$(ReferenceType);</CommonProperties>
3632
<SqlServerLibProperties>$(CommonProperties);AssemblyVersion=$(SqlServerAssemblyVersion);AssemblyFileVersion=$(SqlServerAssemblyFileVersion);Version=$(SqlServerPackageVersion);</SqlServerLibProperties>
3733
<ProjectProperties>$(CommonProperties);AssemblyFileVersion=$(AssemblyFileVersion);TargetsWindows=$(TargetsWindows);TargetsUnix=$(TargetsUnix);</ProjectProperties>
3834
<TestProjectProperties>$(ProjectProperties);BuildForRelease=false;TargetNetCoreVersion=$(TargetNetCoreVersion);TargetNetFxVersion=$(TargetNetFxVersion)</TestProjectProperties>
@@ -52,11 +48,21 @@
5248

5349
<!-- Test configuration properties -->
5450
<PropertyGroup>
55-
<FilterStatement>$(Filter)</FilterStatement>
56-
<FilterStatement Condition="'$(FilterStatement)' == ''">category!=failing&amp;category!=flaky</FilterStatement>
57-
<!--Collect code coverage unless explicitly disabled-->
58-
<CollectCodeCoverage Condition="'$(CollectCodeCoverage)' == ''">true</CollectCodeCoverage>
59-
<CollectStatement Condition="'$(CollectCodeCoverage)' == 'true'">--collect "Code coverage"</CollectStatement>
51+
<!-- Set up default filters for tests to exclude failing and flaky tests -->
52+
<Filter Condition="'$(Filter)' == ''">category!=failing&amp;category!=flaky</Filter>
53+
<FilterArgument>--filter "$(Filter)"</FilterArgument>
54+
55+
<!-- Collect code coverage unless explicitly disabled -->
56+
<CollectCodeCoverage Condition="'$(CollectCodeCoverage)' == ''">true</CollectCodeCoverage>
57+
<CollectArgument Condition="'$(CollectCodeCoverage)' == 'true'">--collect "Code coverage"</CollectArgument>
58+
59+
<!-- Set up tests to fail after hangs and report via blame -->
60+
<BlameArgument>$(Blame)</BlameArgument>
61+
<BlameArgument Condition="'$(BlameArgument)' == ''">
62+
--blame-hang
63+
--blame-hang-dump-type full
64+
--blame-hang-timeout 10m
65+
</BlameArgument>
6066
</PropertyGroup>
6167

6268
<!-- Release Build properties must be turned on for Release purposes, and turned off for Code Coverage calculations -->
@@ -83,17 +89,6 @@
8389
<FunctionalTests Include="**/FunctionalTests/Microsoft.Data.SqlClient.FunctionalTests.csproj" />
8490
<FunctionalTestsProj Include="**/FunctionalTests/Microsoft.Data.SqlClient.FunctionalTests.csproj" />
8591

86-
<ManualTests Include="**/Common/Common.csproj" />
87-
<ManualTests Include="**/ManualTests/SQL/UdtTest/UDTs/Address/Address.csproj" />
88-
<ManualTests Include="**/ManualTests/SQL/UdtTest/UDTs/Circle/Circle.csproj" />
89-
<ManualTests Include="**/ManualTests/SQL/UdtTest/UDTs/Shapes/Shapes.csproj" />
90-
<ManualTests Include="**/ManualTests/SQL/UdtTest/UDTs/Utf8String/Utf8String.csproj" />
91-
<ManualTests Include="**/tools/Microsoft.Data.SqlClient.TestUtilities/Microsoft.Data.SqlClient.TestUtilities.csproj" />
92-
<ManualTests Include="**/tools/CoreFx.Private.TestUtilities/CoreFx.Private.TestUtilities.csproj" />
93-
<ManualTests Include="**/tools/TDS/TDS/TDS.csproj" />
94-
<ManualTests Include="**/tools/TDS/TDS.EndPoint/TDS.EndPoint.csproj" />
95-
<ManualTests Include="**/tools/TDS/TDS.Servers/TDS.Servers.csproj" />
96-
<ManualTests Include="**/CustomConfigurableRetryLogic/CustomRetryLogicProvider.csproj" />
9792
<ManualTests Include="**/ManualTests/Microsoft.Data.SqlClient.ManualTests.csproj" />
9893
<ManualTestsProj Include="**/ManualTests/Microsoft.Data.SqlClient.ManualTests.csproj" />
9994
</ItemGroup>
@@ -104,10 +99,6 @@
10499
<Target Name="BuildAllConfigurations" DependsOnTargets="Restore;BuildTools;BuildSqlServerLib;BuildNetFx;BuildNetCoreAllOS;BuildNetStandard;GenerateMdsPackage" />
105100
<Target Name="BuildSqlServerPackage" DependsOnTargets="BuildSqlServerLibAnyOS;GenerateSqlServerPackage"/>
106101

107-
<!-- @TODO: Manual tests have a reference to AKV provider, and AKV provider is not built on non-windows pipeline runs. Thus it is added to the dependencies of the build tests target. This is not good since it means AKV is built twice on windows and once on unix, in a mix of implicit and explicit. The pipeline should be modified to build it in both cases, or the build should be updated to have dotnet build the test projects. -->
108-
<Target Name="BuildTestsNetCore" DependsOnTargets="RestoreTestsNetCore;BuildAKVNetCore;BuildManualTestsNetCore"/>
109-
<Target Name="BuildTestsNetFx" DependsOnTargets="RestoreTestsNetFx;BuildAKVNetFx;BuildManualTestsNetFx" Condition="$(IsEnabledWindows) == 'true'"/>
110-
111102
<!-- Abstractions Targets -->
112103
<PropertyGroup>
113104
<AbstractionsProperties>$(CommonProperties)</AbstractionsProperties>
@@ -202,18 +193,10 @@
202193
<MSBuild Projects="@(NetCoreDriver)" Targets="restore" Properties="$(ProjectProperties)" />
203194
</Target>
204195

205-
<Target Name="RestoreTestsNetCore" DependsOnTargets="RestoreNetCore">
206-
<MSBuild Projects="@(ManualTests)" Targets="restore" Properties="$(TestProjectProperties)" />
207-
</Target>
208-
209196
<Target Name="RestoreNetFx" DependsOnTargets="RestoreSqlServerLib;RestoreAbstractions" Condition="'$(IsEnabledWindows)' == 'true'">
210197
<MSBuild Projects="@(NetFxDriver)" Targets="restore" Properties="$(ProjectProperties)" />
211198
</Target>
212199

213-
<Target Name="RestoreTestsNetFx" DependsOnTargets="RestoreNetFx" Condition="'$(IsEnabledWindows)' == 'true'">
214-
<MSBuild Projects="@(ManualTests)" Targets="restore" Properties="$(TestProjectProperties)" />
215-
</Target>
216-
217200
<Target Name="RestoreTools" Condition="'$(BuildTools)' == 'true'">
218201
<MSBuild Projects="@(Tools)" Targets="restore" Properties="$(CommonProperties)" />
219202
</Target>
@@ -259,24 +242,6 @@
259242
<MSBuild Projects="@(NetStandardDriver)" Properties="$(CI);$(ProjectProperties);Platform=AnyCPU;OSGroup=AnyOS;BuildForLib=True" RemoveProperties="TargetsWindows;TargetsUnix;" />
260243
</Target>
261244

262-
<Target Name="BuildManualTestsNetCore" DependsOnTargets="RestoreTestsNetCore">
263-
<Message Text=">>> Building ManualTestsNetCore [TestTargetOS=$(TestOS)netcoreapp;$(TestProjectProperties);Platform=AnyCPU;ReferenceType=$(ReferenceType);] ..." Condition="!$(ReferenceType.Contains('Package'))" />
264-
<MSBuild Projects="@(ManualTests)" Properties="TestTargetOS=$(TestOS)netcoreapp;$(TestProjectProperties);Platform=AnyCPU;" Condition="!$(ReferenceType.Contains('Package'))" />
265-
266-
<!-- Only build platform specific builds for Package reference types -->
267-
<Message Text=">>> Building ManualTestsNetCore [TestTargetOS=$(TestOS)netcoreapp;$(TestProjectProperties);Platform=$(Platform)] ..." Condition="$(ReferenceType.Contains('Package'))" />
268-
<MSBuild Projects="@(ManualTests)" Properties="TestTargetOS=$(TestOS)netcoreapp;$(TestProjectProperties);Platform=$(Platform);" Condition="$(ReferenceType.Contains('Package'))" />
269-
</Target>
270-
271-
<Target Name="BuildManualTestsNetFx" DependsOnTargets="RestoreTestsNetFx" Condition="'$(IsEnabledWindows)' == 'true'">
272-
<Message Text=">>> Building ManualTestsNetFx [TestTargetOS=$(TestOS)netfx;$(TestProjectProperties);Platform=AnyCPU;] ..." Condition="!$(ReferenceType.Contains('Package'))" />
273-
<MSBuild Projects="@(ManualTests)" Properties="TestTargetOS=$(TestOS)netfx;$(TestProjectProperties);Platform=AnyCPU;" Condition="!$(ReferenceType.Contains('Package'))" />
274-
275-
<!-- Only build platform specific builds for Package reference types -->
276-
<Message Text=">>> Building ManualTestsNetFx [TestTargetOS=$(TestOS)netfx;$(TestProjectProperties);Platform=$(Platform);] ..." Condition="$(ReferenceType.Contains('Package'))" />
277-
<MSBuild Projects="@(ManualTests)" Properties="TestTargetOS=$(TestOS)netfx;$(TestProjectProperties);Platform=$(Platform);" Condition="$(ReferenceType.Contains('Package'))" />
278-
</Target>
279-
280245
<!-- Tests -->
281246

282247
<!-- Run all tests applicable to the host OS. -->
@@ -296,13 +261,11 @@
296261
$(DotnetPath)dotnet test "@(UnitTestsProj)"
297262
-f $(TF)
298263
-p:Configuration=$(Configuration)
299-
$(CollectStatement)
264+
$(FilterArgument)
265+
$(BlameArgument)
266+
$(CollectArgument)
300267
--results-directory $(ResultsDirectory)
301-
--filter "$(FilterStatement)"
302268
--logger:"trx;LogFilePrefix=Unit-Windows$(TargetGroup)-$(TestSet)"
303-
--blame-hang
304-
--blame-hang-dump-type full
305-
--blame-hang-timeout 10m
306269
</TestCommand>
307270
<!-- Convert more than one whitespace character into one space -->
308271
<TestCommand>$([System.Text.RegularExpressions.Regex]::Replace($(TestCommand), "\s+", " "))</TestCommand>
@@ -318,13 +281,11 @@
318281
$(DotnetPath)dotnet test "@(UnitTestsProj)"
319282
-f $(TF)
320283
-p:Configuration=$(Configuration)
321-
$(CollectStatement)
284+
$(FilterArgument)
285+
$(BlameArgument)
286+
$(CollectArgument)
322287
--results-directory $(ResultsDirectory)
323-
--filter "$(FilterStatement)"
324288
--logger:"trx;LogFilePrefix=Unit-Unixnetcoreapp-$(TestSet)"
325-
--blame-hang
326-
--blame-hang-dump-type full
327-
--blame-hang-timeout 10m
328289
</TestCommand>
329290
<!-- Convert more than one whitespace character into one space -->
330291
<TestCommand>$([System.Text.RegularExpressions.Regex]::Replace($(TestCommand), "\s+", " "))</TestCommand>
@@ -346,13 +307,11 @@
346307
-p:ReferenceType=$(ReferenceType)
347308
-p:AbstractionsPackageVersion=$(AbstractionsPackageVersion)
348309
-p:MdsPackageVersion=$(MdsPackageVersion)
349-
$(CollectStatement)
310+
$(FilterArgument)
311+
$(BlameArgument)
312+
$(CollectArgument)
350313
--results-directory $(ResultsDirectory)
351-
--filter "$(FilterStatement)"
352314
--logger:"trx;LogFilePrefix=Functional-Windows$(TargetGroup)-$(TestSet)"
353-
--blame-hang
354-
--blame-hang-dump-type full
355-
--blame-hang-timeout 10m
356315
</TestCommand>
357316
<!-- Convert more than one whitespace character into one space -->
358317
<TestCommand>$([System.Text.RegularExpressions.Regex]::Replace($(TestCommand), "\s+", " "))</TestCommand>
@@ -371,13 +330,11 @@
371330
-p:ReferenceType=$(ReferenceType)
372331
-p:AbstractionsPackageVersion=$(AbstractionsPackageVersion)
373332
-p:MdsPackageVersion=$(MdsPackageVersion)
374-
$(CollectStatement)
333+
$(FilterArgument)
334+
$(BlameArgument)
335+
$(CollectArgument)
375336
--results-directory $(ResultsDirectory)
376-
--filter "$(FilterStatement)"
377337
--logger:"trx;LogFilePrefix=Functional-Unixnetcoreapp-$(TestSet)"
378-
--blame-hang
379-
--blame-hang-dump-type full
380-
--blame-hang-timeout 10m
381338
</TestCommand>
382339
<!-- Convert more than one whitespace character into one space -->
383340
<TestCommand>$([System.Text.RegularExpressions.Regex]::Replace($(TestCommand), "\s+", " "))</TestCommand>
@@ -394,24 +351,25 @@
394351
<PropertyGroup>
395352
<TestCommand>
396353
$(DotnetPath)dotnet test "@(ManualTestsProj)"
397-
--no-build
398-
-v n
354+
-f $(TF)
399355
-p:Configuration=$(Configuration)
400-
-p:Target$(TFGroup)Version=$(TF)
401356
-p:ReferenceType=$(ReferenceType)
402-
-p:TestSet=$(TestSet)
403-
-p:TestTargetOS=Windows$(TargetGroup)
404357
-p:AbstractionsPackageVersion=$(AbstractionsPackageVersion)
405358
-p:MdsPackageVersion=$(MdsPackageVersion)
406-
$(CollectStatement)
359+
$(FilterArgument)
360+
$(BlameArgument)
361+
$(CollectArgument)
407362
--results-directory $(ResultsDirectory)
408-
--filter "$(FilterStatement)"
409363
--logger:"trx;LogFilePrefix=Manual-Windows$(TargetGroup)-$(TestSet)"
410-
--blame-hang
411-
--blame-hang-dump-type full
412-
--blame-hang-timeout 10m
413364
</TestCommand>
414-
<TestCommand>$(TestCommand.Replace($([System.Environment]::NewLine), " "))</TestCommand>
365+
<!-- Add test set only if it was provided - otherwise it will be permanently set to '' -->
366+
<TestCommand Condition="'$(TestSet)' != ''">
367+
$(TestCommand)
368+
-p:TestSet=$(TestSet)
369+
</TestCommand>
370+
371+
<!-- Convert more than one whitespace character into one space -->
372+
<TestCommand>$([System.Text.RegularExpressions.Regex]::Replace($(TestCommand), "\s+", " "))</TestCommand>
415373
</PropertyGroup>
416374
<Message Text=">>> Running Manual test for Windows via command: $(TestCommand)" />
417375
<Exec ConsoleToMsBuild="true" Command="$(TestCommand)" />
@@ -422,24 +380,26 @@
422380
<PropertyGroup>
423381
<TestCommand>
424382
$(DotnetPath)dotnet test "@(ManualTestsProj)"
425-
--no-build
426-
-v n
383+
-f $(TF)
427384
-p:Configuration=$(Configuration)
428-
-p:TargetNetCoreVersion=$(TF)
429385
-p:ReferenceType=$(ReferenceType)
430-
-p:TestSet=$(TestSet)
431-
-p:TestTargetOS=Unixnetcoreapp
432386
-p:AbstractionsPackageVersion=$(AbstractionsPackageVersion)
433387
-p:MdsPackageVersion=$(MdsPackageVersion)
434-
$(CollectStatement)
388+
$(FilterArgument)
389+
$(BlameArgument)
390+
$(CollectArgument)
435391
--results-directory $(ResultsDirectory)
436-
--filter "$(FilterStatement)"
437392
--logger:"trx;LogFilePrefix=Manual-Unixnetcoreapp-$(TestSet)"
438-
--blame-hang
439-
--blame-hang-dump-type full
440-
--blame-hang-timeout 10m
441393
</TestCommand>
442-
<TestCommand>$(TestCommand.Replace($([System.Environment]::NewLine), " "))</TestCommand>
394+
395+
<!-- Add test set only if it was provided - otherwise it will be permanently set to '' -->
396+
<TestCommand Condition="'$(TestSet)' != ''">
397+
$(TestCommand)
398+
-p:TestSet=$(TestSet)
399+
</TestCommand>
400+
401+
<!-- Convert more than one whitespace character into one space -->
402+
<TestCommand>$([System.Text.RegularExpressions.Regex]::Replace($(TestCommand), "\s+", " "))</TestCommand>
443403
</PropertyGroup>
444404
<Message Text=">>> Running Manual test for Unix via command: $(TestCommand)" />
445405
<Exec ConsoleToMsBuild="true" Command="$(TestCommand)" />

eng/pipelines/common/templates/jobs/ci-run-tests-job.yml

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ parameters:
2626
# SupportsFileStream
2727
# SupportsIntegratedSecurity
2828
# TracingEnabled
29-
#
3029
- name: configProperties
3130
type: object
3231
default: {} # - key: 'value'
@@ -288,17 +287,6 @@ jobs:
288287
${{ if parameters.configProperties.FileStreamDirectory }}:
289288
fileStreamDirectory: ${{ parameters.configProperties.FileStreamDirectory }}
290289

291-
- template: /eng/pipelines/common/templates/steps/build-all-tests-step.yml@self # build tests
292-
parameters:
293-
targetFramework: ${{ parameters.targetFramework }}
294-
buildConfiguration: ${{ parameters.buildConfiguration }}
295-
referenceType: ${{ parameters.referenceType }}
296-
testSet: ${{ parameters.testSet }}
297-
abstractionsPackageVersion: ${{ parameters.abstractionsPackageVersion }}
298-
mdsPackageVersion: ${{ parameters.mdsPackageVersion }}
299-
${{ if ne(parameters.operatingSystem, 'Windows') }}:
300-
OSGroup: Unix
301-
302290
- ${{ if eq(parameters.enableX64Test, true) }}: # run native tests
303291
- template: /eng/pipelines/common/templates/steps/run-all-tests-step.yml@self # run tests
304292
parameters:

0 commit comments

Comments
 (0)