Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions build.proj
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@
The provided path should be ended to a `\` character without white spaces: Ex. C:\x86\
-->
<DotnetPath></DotnetPath>
<!-- Default filter for test runs. Override with -p:Filter=... -->
<Filter Condition="'$(Filter)' == ''">category!=failing&amp;category!=flaky</Filter>
<!-- Using these properties to compile and pack netfx dll fixes nuget package explorer error "Compiler flags: missing" -->
<NugetPackProperties>DebugType=portable;DebugSymbols=true;IncludeSymbols=true;SymbolPackageFormat=snupkg;PublishRepositoryUrl=true;RepositoryUrl=https://github.com/dotnet/sqlclient;RepositoryType=git;EmbedUnTrackedSources=true;Deterministic=true;</NugetPackProperties>
<!-- TF_BUILD is enabled only within AzureDevOps pipeline to support continuous integation build. -->
Expand Down Expand Up @@ -226,13 +228,13 @@
-p:TestTargetOS=Windows$(TargetGroup)
--collect "Code coverage"
--results-directory $(ResultsDirectory)
--filter "category!=failing%26category!=flaky"
--filter "$(Filter)"
--logger:"trx;LogFilePrefix=Unit-Windows$(TargetGroup)-$(TestSet)"
</TestCommand>
<TestCommand>$(TestCommand.Replace($([System.Environment]::NewLine), " "))</TestCommand>
</PropertyGroup>
<Message Text=">>> Running unit tests for Windows via command: $(TestCommand)"/>
<Exec ConsoleToMsBuild="true" Command="$(TestCommand)"/>

Check failure on line 237 in build.proj

View check run for this annotation

Azure Pipelines / CI-SqlClient (Win22_Azure_Sql net462_AnyCPU_1)

build.proj#L237

build.proj(237,5): Error MSB3073: The command " dotnet test "src\Microsoft.Data.SqlClient\tests\UnitTests\Microsoft.Data.SqlClient.UnitTests.csproj" --no-build -v n -p:Configuration=Release -p:TargetnetfxVersion=net462 -p:TestTargetOS=Windowsnetfx --collect "Code coverage" --results-directory TestResults --filter "category=flaky" --logger:"trx;LogFilePrefix=Unit-Windowsnetfx-1,2,3" " exited with code 1.

Check failure on line 237 in build.proj

View check run for this annotation

Azure Pipelines / CI-SqlClient (Win22_Sql19 net462_AnyCPU_2)

build.proj#L237

build.proj(237,5): Error MSB3073: The command " dotnet test "src\Microsoft.Data.SqlClient\tests\UnitTests\Microsoft.Data.SqlClient.UnitTests.csproj" --no-build -v n -p:Configuration=Release -p:TargetnetfxVersion=net462 -p:TestTargetOS=Windowsnetfx --collect "Code coverage" --results-directory TestResults --filter "category=flaky" --logger:"trx;LogFilePrefix=Unit-Windowsnetfx-1,2,3" " exited with code 1.

Check failure on line 237 in build.proj

View check run for this annotation

Azure Pipelines / CI-SqlClient (Win22_Sql22_x86 net462_AnyCPU_2)

build.proj#L237

build.proj(237,5): Error MSB3073: The command " C:\x86\dotnet test "src\Microsoft.Data.SqlClient\tests\UnitTests\Microsoft.Data.SqlClient.UnitTests.csproj" --no-build -v n -p:Configuration=Release -p:TargetnetfxVersion=net462 -p:TestTargetOS=Windowsnetfx --collect "Code coverage" --results-directory TestResults --filter "category=flaky" --logger:"trx;LogFilePrefix=Unit-Windowsnetfx-1,2,3" " exited with code 1.

Check failure on line 237 in build.proj

View check run for this annotation

Azure Pipelines / CI-SqlClient (Win22_Sql19 net462_AnyCPU_1)

build.proj#L237

build.proj(237,5): Error MSB3073: The command " dotnet test "src\Microsoft.Data.SqlClient\tests\UnitTests\Microsoft.Data.SqlClient.UnitTests.csproj" --no-build -v n -p:Configuration=Release -p:TargetnetfxVersion=net462 -p:TestTargetOS=Windowsnetfx --collect "Code coverage" --results-directory TestResults --filter "category=flaky" --logger:"trx;LogFilePrefix=Unit-Windowsnetfx-1,2,3" " exited with code 1.

Check failure on line 237 in build.proj

View check run for this annotation

Azure Pipelines / CI-SqlClient (Win22_Sql22_x86 net462_AnyCPU_1)

build.proj#L237

build.proj(237,5): Error MSB3073: The command " C:\x86\dotnet test "src\Microsoft.Data.SqlClient\tests\UnitTests\Microsoft.Data.SqlClient.UnitTests.csproj" --no-build -v n -p:Configuration=Release -p:TargetnetfxVersion=net462 -p:TestTargetOS=Windowsnetfx --collect "Code coverage" --results-directory TestResults --filter "category=flaky" --logger:"trx;LogFilePrefix=Unit-Windowsnetfx-1,2,3" " exited with code 1.

Check failure on line 237 in build.proj

View check run for this annotation

Azure Pipelines / CI-SqlClient (win11_Azure_Sql net8_0_AnyCPU_ManagedSNI_1)

build.proj#L237

build.proj(237,5): Error MSB3073: The command " dotnet test "src\Microsoft.Data.SqlClient\tests\UnitTests\Microsoft.Data.SqlClient.UnitTests.csproj" --no-build -v n -p:Configuration=Release -p:TargetnetcoreVersion=net8.0 -p:TestTargetOS=Windowsnetcoreapp --collect "Code coverage" --results-directory TestResults --filter "category=flaky" --logger:"trx;LogFilePrefix=Unit-Windowsnetcoreapp-1,2,3" " exited with code 1.

Check failure on line 237 in build.proj

View check run for this annotation

Azure Pipelines / CI-SqlClient (Win11_ARM64_Azure_Sql net9_0_AnyCPU_NativeSNI_1)

build.proj#L237

build.proj(237,5): Error MSB3073: The command " dotnet test "src\Microsoft.Data.SqlClient\tests\UnitTests\Microsoft.Data.SqlClient.UnitTests.csproj" --no-build -v n -p:Configuration=Release -p:TargetnetcoreVersion=net9.0 -p:TestTargetOS=Windowsnetcoreapp --collect "Code coverage" --results-directory TestResults --filter "category=flaky" --logger:"trx;LogFilePrefix=Unit-Windowsnetcoreapp-1,2,3" " exited with code 1.

Check failure on line 237 in build.proj

View check run for this annotation

Azure Pipelines / CI-SqlClient (Win22_Azure_Sql net462_AnyCPU_3)

build.proj#L237

build.proj(237,5): Error MSB3073: The command " dotnet test "src\Microsoft.Data.SqlClient\tests\UnitTests\Microsoft.Data.SqlClient.UnitTests.csproj" --no-build -v n -p:Configuration=Release -p:TargetnetfxVersion=net462 -p:TestTargetOS=Windowsnetfx --collect "Code coverage" --results-directory TestResults --filter "category=flaky" --logger:"trx;LogFilePrefix=Unit-Windowsnetfx-1,2,3" " exited with code 1.

Check failure on line 237 in build.proj

View check run for this annotation

Azure Pipelines / CI-SqlClient (Win11_ARM64_Azure_Sql net8_0_AnyCPU_ManagedSNI_2)

build.proj#L237

build.proj(237,5): Error MSB3073: The command " dotnet test "src\Microsoft.Data.SqlClient\tests\UnitTests\Microsoft.Data.SqlClient.UnitTests.csproj" --no-build -v n -p:Configuration=Release -p:TargetnetcoreVersion=net8.0 -p:TestTargetOS=Windowsnetcoreapp --collect "Code coverage" --results-directory TestResults --filter "category=flaky" --logger:"trx;LogFilePrefix=Unit-Windowsnetcoreapp-1,2,3" " exited with code 1.

Check failure on line 237 in build.proj

View check run for this annotation

Azure Pipelines / CI-SqlClient (Win11_ARM64_Azure_Sql net9_0_AnyCPU_ManagedSNI_3)

build.proj#L237

build.proj(237,5): Error MSB3073: The command " dotnet test "src\Microsoft.Data.SqlClient\tests\UnitTests\Microsoft.Data.SqlClient.UnitTests.csproj" --no-build -v n -p:Configuration=Release -p:TargetnetcoreVersion=net9.0 -p:TestTargetOS=Windowsnetcoreapp --collect "Code coverage" --results-directory TestResults --filter "category=flaky" --logger:"trx;LogFilePrefix=Unit-Windowsnetcoreapp-1,2,3" " exited with code 1.
</Target>

<!-- Run all unit tests applicable to Unix. -->
Expand All @@ -247,7 +249,7 @@
-p:TestTargetOS=Unixnetcoreapp
--collect "Code coverage"
--results-directory $(ResultsDirectory)
--filter "category!=failing%26category!=flaky"
--filter "$(Filter)"
--logger:"trx;LogFilePrefix=Unit-Unixnetcoreapp-$(TestSet)"
</TestCommand>
<TestCommand>$(TestCommand.Replace($([System.Environment]::NewLine), " "))</TestCommand>
Expand All @@ -273,7 +275,7 @@
-p:TestTargetOS=Windows$(TargetGroup)
--collect "Code coverage"
--results-directory $(ResultsDirectory)
--filter "category!=non$(TargetGroup)tests&amp;category!=failing&amp;category!=nonwindowstests"
--filter "$(Filter)&amp;category!=non$(TargetGroup)tests&amp;category!=nonwindowstests"
--logger:"trx;LogFilePrefix=Functional-Windows$(TargetGroup)-$(TestSet)"
</TestCommand>
<TestCommand>$(TestCommand.Replace($([System.Environment]::NewLine), " "))</TestCommand>
Expand All @@ -296,7 +298,7 @@
-p:TestTargetOS=Unixnetcoreapp
--collect "Code coverage"
--results-directory $(ResultsDirectory)
--filter "category!=nonnetcoreapptests&amp;category!=failing&amp;category!=nonlinuxtests&amp;category!=nonuaptests"
--filter "$(Filter)&amp;category!=nonnetcoreapptests&amp;category!=nonlinuxtests&amp;category!=nonuaptests"
--logger:"trx;LogFilePrefix=Functional-Unixnetcoreapp-$(TestSet)"
</TestCommand>
<TestCommand>$(TestCommand.Replace($([System.Environment]::NewLine), " "))</TestCommand>
Expand All @@ -322,13 +324,13 @@
-p:TestTargetOS=Windows$(TargetGroup)
--collect "Code coverage"
--results-directory $(ResultsDirectory)
--filter "category!=non$(TargetGroup)tests&amp;category!=failing&amp;category!=nonwindowstests"
--filter "$(Filter)&amp;category!=non$(TargetGroup)tests&amp;category!=nonwindowstests"
--logger:"trx;LogFilePrefix=Manual-Windows$(TargetGroup)-$(TestSet)"
</TestCommand>
<TestCommand>$(TestCommand.Replace($([System.Environment]::NewLine), " "))</TestCommand>
</PropertyGroup>
<Message Text=">>> Running Manual test for Windows via command: $(TestCommand)" />
<Exec ConsoleToMsBuild="true" Command="$(TestCommand)" />

Check failure on line 333 in build.proj

View check run for this annotation

Azure Pipelines / CI-SqlClient (Win22_Azure_Sql net8_0_AnyCPU_NativeSNI_3)

build.proj#L333

build.proj(333,5): Error MSB3073: The command " dotnet test "src\Microsoft.Data.SqlClient\tests\ManualTests\Microsoft.Data.SqlClient.ManualTesting.Tests.csproj" --no-build -v n -p:Configuration=Release -p:TargetnetcoreVersion=net8.0 -p:ReferenceType=Project -p:TestSet=3 -p:TestTargetOS=Windowsnetcoreapp --collect "Code coverage" --results-directory TestResults --filter "category=flaky&category!=nonnetcoreapptests&category!=nonwindowstests" --logger:"trx;LogFilePrefix=Manual-Windowsnetcoreapp-3" " exited with code 1.

Check failure on line 333 in build.proj

View check run for this annotation

Azure Pipelines / CI-SqlClient (Win22_Azure_Sql net8_0_AnyCPU_ManagedSNI_3)

build.proj#L333

build.proj(333,5): Error MSB3073: The command " dotnet test "src\Microsoft.Data.SqlClient\tests\ManualTests\Microsoft.Data.SqlClient.ManualTesting.Tests.csproj" --no-build -v n -p:Configuration=Release -p:TargetnetcoreVersion=net8.0 -p:ReferenceType=Project -p:TestSet=3 -p:TestTargetOS=Windowsnetcoreapp --collect "Code coverage" --results-directory TestResults --filter "category=flaky&category!=nonnetcoreapptests&category!=nonwindowstests" --logger:"trx;LogFilePrefix=Manual-Windowsnetcoreapp-3" " exited with code 1.

Check failure on line 333 in build.proj

View check run for this annotation

Azure Pipelines / CI-SqlClient (Win22_Azure_Sql net462_AnyCPU_3)

build.proj#L333

build.proj(333,5): Error MSB3073: The command " dotnet test "src\Microsoft.Data.SqlClient\tests\ManualTests\Microsoft.Data.SqlClient.ManualTesting.Tests.csproj" --no-build -v n -p:Configuration=Release -p:TargetnetfxVersion=net462 -p:ReferenceType=Project -p:TestSet=3 -p:TestTargetOS=Windowsnetfx --collect "Code coverage" --results-directory TestResults --filter "category=flaky&category!=nonnetfxtests&category!=nonwindowstests" --logger:"trx;LogFilePrefix=Manual-Windowsnetfx-3" " exited with code 1.

Check failure on line 333 in build.proj

View check run for this annotation

Azure Pipelines / CI-SqlClient (win11_Azure_Sql net9_0_AnyCPU_ManagedSNI_3)

build.proj#L333

build.proj(333,5): Error MSB3073: The command " dotnet test "src\Microsoft.Data.SqlClient\tests\ManualTests\Microsoft.Data.SqlClient.ManualTesting.Tests.csproj" --no-build -v n -p:Configuration=Release -p:TargetnetcoreVersion=net9.0 -p:ReferenceType=Project -p:TestSet=3 -p:TestTargetOS=Windowsnetcoreapp --collect "Code coverage" --results-directory TestResults --filter "category=flaky&category!=nonnetcoreapptests&category!=nonwindowstests" --logger:"trx;LogFilePrefix=Manual-Windowsnetcoreapp-3" " exited with code 1.

Check failure on line 333 in build.proj

View check run for this annotation

Azure Pipelines / CI-SqlClient-Package (Win22_Azure_Sql net462_AnyCPU_3)

build.proj#L333

build.proj(333,5): Error MSB3073: The command " dotnet test "src\Microsoft.Data.SqlClient\tests\ManualTests\Microsoft.Data.SqlClient.ManualTesting.Tests.csproj" --no-build -v n -p:Configuration=Release -p:TargetnetfxVersion=net462 -p:ReferenceType=Package -p:TestSet=3 -p:TestTargetOS=Windowsnetfx --collect "Code coverage" --results-directory TestResults --filter "category=flaky&category!=nonnetfxtests&category!=nonwindowstests" --logger:"trx;LogFilePrefix=Manual-Windowsnetfx-3" " exited with code 1.

Check failure on line 333 in build.proj

View check run for this annotation

Azure Pipelines / CI-SqlClient (win11_Azure_Sql net8_0_AnyCPU_NativeSNI_3)

build.proj#L333

build.proj(333,5): Error MSB3073: The command " dotnet test "src\Microsoft.Data.SqlClient\tests\ManualTests\Microsoft.Data.SqlClient.ManualTesting.Tests.csproj" --no-build -v n -p:Configuration=Release -p:TargetnetcoreVersion=net8.0 -p:ReferenceType=Project -p:TestSet=3 -p:TestTargetOS=Windowsnetcoreapp --collect "Code coverage" --results-directory TestResults --filter "category=flaky&category!=nonnetcoreapptests&category!=nonwindowstests" --logger:"trx;LogFilePrefix=Manual-Windowsnetcoreapp-3" " exited with code 1.

Check failure on line 333 in build.proj

View check run for this annotation

Azure Pipelines / CI-SqlClient (win11_Azure_Sql net462_AnyCPU_3)

build.proj#L333

build.proj(333,5): Error MSB3073: The command " dotnet test "src\Microsoft.Data.SqlClient\tests\ManualTests\Microsoft.Data.SqlClient.ManualTesting.Tests.csproj" --no-build -v n -p:Configuration=Release -p:TargetnetfxVersion=net462 -p:ReferenceType=Project -p:TestSet=3 -p:TestTargetOS=Windowsnetfx --collect "Code coverage" --results-directory TestResults --filter "category=flaky&category!=nonnetfxtests&category!=nonwindowstests" --logger:"trx;LogFilePrefix=Manual-Windowsnetfx-3" " exited with code 1.

Check failure on line 333 in build.proj

View check run for this annotation

Azure Pipelines / CI-SqlClient-Package (Win22_Azure_Sql net8_0_AnyCPU_NativeSNI_3)

build.proj#L333

build.proj(333,5): Error MSB3073: The command " dotnet test "src\Microsoft.Data.SqlClient\tests\ManualTests\Microsoft.Data.SqlClient.ManualTesting.Tests.csproj" --no-build -v n -p:Configuration=Release -p:TargetnetcoreVersion=net8.0 -p:ReferenceType=Package -p:TestSet=3 -p:TestTargetOS=Windowsnetcoreapp --collect "Code coverage" --results-directory TestResults --filter "category=flaky&category!=nonnetcoreapptests&category!=nonwindowstests" --logger:"trx;LogFilePrefix=Manual-Windowsnetcoreapp-3" " exited with code 1.

Check failure on line 333 in build.proj

View check run for this annotation

Azure Pipelines / CI-SqlClient-Package (Win22_Azure_Sql net9_0_AnyCPU_ManagedSNI_3)

build.proj#L333

build.proj(333,5): Error MSB3073: The command " dotnet test "src\Microsoft.Data.SqlClient\tests\ManualTests\Microsoft.Data.SqlClient.ManualTesting.Tests.csproj" --no-build -v n -p:Configuration=Release -p:TargetnetcoreVersion=net9.0 -p:ReferenceType=Package -p:TestSet=3 -p:TestTargetOS=Windowsnetcoreapp --collect "Code coverage" --results-directory TestResults --filter "category=flaky&category!=nonnetcoreapptests&category!=nonwindowstests" --logger:"trx;LogFilePrefix=Manual-Windowsnetcoreapp-3" " exited with code 1.

Check failure on line 333 in build.proj

View check run for this annotation

Azure Pipelines / CI-SqlClient (win11_Azure_Sql net8_0_AnyCPU_ManagedSNI_3)

build.proj#L333

build.proj(333,5): Error MSB3073: The command " dotnet test "src\Microsoft.Data.SqlClient\tests\ManualTests\Microsoft.Data.SqlClient.ManualTesting.Tests.csproj" --no-build -v n -p:Configuration=Release -p:TargetnetcoreVersion=net8.0 -p:ReferenceType=Project -p:TestSet=3 -p:TestTargetOS=Windowsnetcoreapp --collect "Code coverage" --results-directory TestResults --filter "category=flaky&category!=nonnetcoreapptests&category!=nonwindowstests" --logger:"trx;LogFilePrefix=Manual-Windowsnetcoreapp-3" " exited with code 1.

Check failure on line 333 in build.proj

View check run for this annotation

Azure Pipelines / CI-SqlClient-Package (win11_Azure_Sql net8_0_AnyCPU_ManagedSNI_3)

build.proj#L333

build.proj(333,5): Error MSB3073: The command " dotnet test "src\Microsoft.Data.SqlClient\tests\ManualTests\Microsoft.Data.SqlClient.ManualTesting.Tests.csproj" --no-build -v n -p:Configuration=Release -p:TargetnetcoreVersion=net8.0 -p:ReferenceType=Package -p:TestSet=3 -p:TestTargetOS=Windowsnetcoreapp --collect "Code coverage" --results-directory TestResults --filter "category=flaky&category!=nonnetcoreapptests&category!=nonwindowstests" --logger:"trx;LogFilePrefix=Manual-Windowsnetcoreapp-3" " exited with code 1.

Check failure on line 333 in build.proj

View check run for this annotation

Azure Pipelines / CI-SqlClient (Win11_ARM64_Azure_Sql net9_0_AnyCPU_NativeSNI_3)

build.proj#L333

build.proj(333,5): Error MSB3073: The command " dotnet test "src\Microsoft.Data.SqlClient\tests\ManualTests\Microsoft.Data.SqlClient.ManualTesting.Tests.csproj" --no-build -v n -p:Configuration=Release -p:TargetnetcoreVersion=net9.0 -p:ReferenceType=Project -p:TestSet=3 -p:TestTargetOS=Windowsnetcoreapp --collect "Code coverage" --results-directory TestResults --filter "category!=failing&category!=flaky&category!=nonnetcoreapptests&category!=nonwindowstests" --logger:"trx;LogFilePrefix=Manual-Windowsnetcoreapp-3" " exited with code 1.

Check failure on line 333 in build.proj

View check run for this annotation

Azure Pipelines / CI-SqlClient (Win22_Azure_Sql net9_0_AnyCPU_ManagedSNI_3)

build.proj#L333

build.proj(333,5): Error MSB3073: The command " dotnet test "src\Microsoft.Data.SqlClient\tests\ManualTests\Microsoft.Data.SqlClient.ManualTesting.Tests.csproj" --no-build -v n -p:Configuration=Release -p:TargetnetcoreVersion=net9.0 -p:ReferenceType=Project -p:TestSet=3 -p:TestTargetOS=Windowsnetcoreapp --collect "Code coverage" --results-directory TestResults --filter "category!=failing&category!=flaky&category!=nonnetcoreapptests&category!=nonwindowstests" --logger:"trx;LogFilePrefix=Manual-Windowsnetcoreapp-3" " exited with code 1.

Check failure on line 333 in build.proj

View check run for this annotation

Azure Pipelines / CI-SqlClient (Win22_Azure_Sql net9_0_AnyCPU_ManagedSNI_3)

build.proj#L333

build.proj(333,5): Error MSB3073: The command " dotnet test "src\Microsoft.Data.SqlClient\tests\ManualTests\Microsoft.Data.SqlClient.ManualTesting.Tests.csproj" --no-build -v n -p:Configuration=Release -p:TargetnetcoreVersion=net9.0 -p:ReferenceType=Project -p:TestSet=3 -p:TestTargetOS=Windowsnetcoreapp --collect "Code coverage" --results-directory TestResults --filter "category=flaky&category!=nonnetcoreapptests&category!=nonwindowstests" --logger:"trx;LogFilePrefix=Manual-Windowsnetcoreapp-3" " exited with code 1.

Check failure on line 333 in build.proj

View check run for this annotation

Azure Pipelines / CI-SqlClient-Package (win11_Azure_Sql net9_0_AnyCPU_NativeSNI_3)

build.proj#L333

build.proj(333,5): Error MSB3073: The command " dotnet test "src\Microsoft.Data.SqlClient\tests\ManualTests\Microsoft.Data.SqlClient.ManualTesting.Tests.csproj" --no-build -v n -p:Configuration=Release -p:TargetnetcoreVersion=net9.0 -p:ReferenceType=Package -p:TestSet=3 -p:TestTargetOS=Windowsnetcoreapp --collect "Code coverage" --results-directory TestResults --filter "category=flaky&category!=nonnetcoreapptests&category!=nonwindowstests" --logger:"trx;LogFilePrefix=Manual-Windowsnetcoreapp-3" " exited with code 1.

Check failure on line 333 in build.proj

View check run for this annotation

Azure Pipelines / CI-SqlClient-Package (Win22_Azure_Sql net9_0_AnyCPU_NativeSNI_3)

build.proj#L333

build.proj(333,5): Error MSB3073: The command " dotnet test "src\Microsoft.Data.SqlClient\tests\ManualTests\Microsoft.Data.SqlClient.ManualTesting.Tests.csproj" --no-build -v n -p:Configuration=Release -p:TargetnetcoreVersion=net9.0 -p:ReferenceType=Package -p:TestSet=3 -p:TestTargetOS=Windowsnetcoreapp --collect "Code coverage" --results-directory TestResults --filter "category=flaky&category!=nonnetcoreapptests&category!=nonwindowstests" --logger:"trx;LogFilePrefix=Manual-Windowsnetcoreapp-3" " exited with code 1.

Check failure on line 333 in build.proj

View check run for this annotation

Azure Pipelines / CI-SqlClient-Package (win11_Azure_Sql net8_0_AnyCPU_NativeSNI_3)

build.proj#L333

build.proj(333,5): Error MSB3073: The command " dotnet test "src\Microsoft.Data.SqlClient\tests\ManualTests\Microsoft.Data.SqlClient.ManualTesting.Tests.csproj" --no-build -v n -p:Configuration=Release -p:TargetnetcoreVersion=net8.0 -p:ReferenceType=Package -p:TestSet=3 -p:TestTargetOS=Windowsnetcoreapp --collect "Code coverage" --results-directory TestResults --filter "category=flaky&category!=nonnetcoreapptests&category!=nonwindowstests" --logger:"trx;LogFilePrefix=Manual-Windowsnetcoreapp-3" " exited with code 1.

Check failure on line 333 in build.proj

View check run for this annotation

Azure Pipelines / CI-SqlClient (Win22_Azure_Sql net9_0_AnyCPU_NativeSNI_3)

build.proj#L333

build.proj(333,5): Error MSB3073: The command " dotnet test "src\Microsoft.Data.SqlClient\tests\ManualTests\Microsoft.Data.SqlClient.ManualTesting.Tests.csproj" --no-build -v n -p:Configuration=Release -p:TargetnetcoreVersion=net9.0 -p:ReferenceType=Project -p:TestSet=3 -p:TestTargetOS=Windowsnetcoreapp --collect "Code coverage" --results-directory TestResults --filter "category=flaky&category!=nonnetcoreapptests&category!=nonwindowstests" --logger:"trx;LogFilePrefix=Manual-Windowsnetcoreapp-3" " exited with code 1.

Check failure on line 333 in build.proj

View check run for this annotation

Azure Pipelines / CI-SqlClient (Win22_Azure_Sql net9_0_AnyCPU_NativeSNI_3)

build.proj#L333

build.proj(333,5): Error MSB3073: The command " dotnet test "src\Microsoft.Data.SqlClient\tests\ManualTests\Microsoft.Data.SqlClient.ManualTesting.Tests.csproj" --no-build -v n -p:Configuration=Release -p:TargetnetcoreVersion=net9.0 -p:ReferenceType=Project -p:TestSet=3 -p:TestTargetOS=Windowsnetcoreapp --collect "Code coverage" --results-directory TestResults --filter "category!=failing&category!=flaky&category!=nonnetcoreapptests&category!=nonwindowstests" --logger:"trx;LogFilePrefix=Manual-Windowsnetcoreapp-3" " exited with code 1.

Check failure on line 333 in build.proj

View check run for this annotation

Azure Pipelines / CI-SqlClient-Package (win11_Azure_Sql net462_AnyCPU_3)

build.proj#L333

build.proj(333,5): Error MSB3073: The command " dotnet test "src\Microsoft.Data.SqlClient\tests\ManualTests\Microsoft.Data.SqlClient.ManualTesting.Tests.csproj" --no-build -v n -p:Configuration=Release -p:TargetnetfxVersion=net462 -p:ReferenceType=Package -p:TestSet=3 -p:TestTargetOS=Windowsnetfx --collect "Code coverage" --results-directory TestResults --filter "category=flaky&category!=nonnetfxtests&category!=nonwindowstests" --logger:"trx;LogFilePrefix=Manual-Windowsnetfx-3" " exited with code 1.

Check failure on line 333 in build.proj

View check run for this annotation

Azure Pipelines / CI-SqlClient (win11_Azure_Sql net9_0_AnyCPU_NativeSNI_3)

build.proj#L333

build.proj(333,5): Error MSB3073: The command " dotnet test "src\Microsoft.Data.SqlClient\tests\ManualTests\Microsoft.Data.SqlClient.ManualTesting.Tests.csproj" --no-build -v n -p:Configuration=Release -p:TargetnetcoreVersion=net9.0 -p:ReferenceType=Project -p:TestSet=3 -p:TestTargetOS=Windowsnetcoreapp --collect "Code coverage" --results-directory TestResults --filter "category=flaky&category!=nonnetcoreapptests&category!=nonwindowstests" --logger:"trx;LogFilePrefix=Manual-Windowsnetcoreapp-3" " exited with code 1.

Check failure on line 333 in build.proj

View check run for this annotation

Azure Pipelines / CI-SqlClient (Win11_ARM64_Azure_Sql net8_0_AnyCPU_NativeSNI_3)

build.proj#L333

build.proj(333,5): Error MSB3073: The command " dotnet test "src\Microsoft.Data.SqlClient\tests\ManualTests\Microsoft.Data.SqlClient.ManualTesting.Tests.csproj" --no-build -v n -p:Configuration=Release -p:TargetnetcoreVersion=net8.0 -p:ReferenceType=Project -p:TestSet=3 -p:TestTargetOS=Windowsnetcoreapp --collect "Code coverage" --results-directory TestResults --filter "category!=failing&category!=flaky&category!=nonnetcoreapptests&category!=nonwindowstests" --logger:"trx;LogFilePrefix=Manual-Windowsnetcoreapp-3" " exited with code 1.

Check failure on line 333 in build.proj

View check run for this annotation

Azure Pipelines / CI-SqlClient-Package (Win22_Azure_Sql net8_0_AnyCPU_ManagedSNI_3)

build.proj#L333

build.proj(333,5): Error MSB3073: The command " dotnet test "src\Microsoft.Data.SqlClient\tests\ManualTests\Microsoft.Data.SqlClient.ManualTesting.Tests.csproj" --no-build -v n -p:Configuration=Release -p:TargetnetcoreVersion=net8.0 -p:ReferenceType=Package -p:TestSet=3 -p:TestTargetOS=Windowsnetcoreapp --collect "Code coverage" --results-directory TestResults --filter "category=flaky&category!=nonnetcoreapptests&category!=nonwindowstests" --logger:"trx;LogFilePrefix=Manual-Windowsnetcoreapp-3" " exited with code 1.

Check failure on line 333 in build.proj

View check run for this annotation

Azure Pipelines / CI-SqlClient-Package (Win22_Azure_Sql net8_0_AnyCPU_ManagedSNI_3)

build.proj#L333

build.proj(333,5): Error MSB3073: The command " dotnet test "src\Microsoft.Data.SqlClient\tests\ManualTests\Microsoft.Data.SqlClient.ManualTesting.Tests.csproj" --no-build -v n -p:Configuration=Release -p:TargetnetcoreVersion=net8.0 -p:ReferenceType=Package -p:TestSet=3 -p:TestTargetOS=Windowsnetcoreapp --collect "Code coverage" --results-directory TestResults --filter "category!=failing&category!=flaky&category!=nonnetcoreapptests&category!=nonwindowstests" --logger:"trx;LogFilePrefix=Manual-Windowsnetcoreapp-3" " exited with code 1.

Check failure on line 333 in build.proj

View check run for this annotation

Azure Pipelines / CI-SqlClient-Package (Win11_ARM64_Azure_Sql net462_AnyCPU_3)

build.proj#L333

build.proj(333,5): Error MSB3073: The command " dotnet test "src\Microsoft.Data.SqlClient\tests\ManualTests\Microsoft.Data.SqlClient.ManualTesting.Tests.csproj" --no-build -v n -p:Configuration=Release -p:TargetnetfxVersion=net462 -p:ReferenceType=Package -p:TestSet=3 -p:TestTargetOS=Windowsnetfx --collect "Code coverage" --results-directory TestResults --filter "category=flaky&category!=nonnetfxtests&category!=nonwindowstests" --logger:"trx;LogFilePrefix=Manual-Windowsnetfx-3" " exited with code 1.

Check failure on line 333 in build.proj

View check run for this annotation

Azure Pipelines / CI-SqlClient-Package (Win11_ARM64_Azure_Sql net9_0_AnyCPU_NativeSNI_3)

build.proj#L333

build.proj(333,5): Error MSB3073: The command " dotnet test "src\Microsoft.Data.SqlClient\tests\ManualTests\Microsoft.Data.SqlClient.ManualTesting.Tests.csproj" --no-build -v n -p:Configuration=Release -p:TargetnetcoreVersion=net9.0 -p:ReferenceType=Package -p:TestSet=3 -p:TestTargetOS=Windowsnetcoreapp --collect "Code coverage" --results-directory TestResults --filter "category!=failing&category!=flaky&category!=nonnetcoreapptests&category!=nonwindowstests" --logger:"trx;LogFilePrefix=Manual-Windowsnetcoreapp-3" " exited with code 1.

Check failure on line 333 in build.proj

View check run for this annotation

Azure Pipelines / CI-SqlClient-Package (Win11_ARM64_Azure_Sql net8_0_AnyCPU_ManagedSNI_3)

build.proj#L333

build.proj(333,5): Error MSB3073: The command " dotnet test "src\Microsoft.Data.SqlClient\tests\ManualTests\Microsoft.Data.SqlClient.ManualTesting.Tests.csproj" --no-build -v n -p:Configuration=Release -p:TargetnetcoreVersion=net8.0 -p:ReferenceType=Package -p:TestSet=3 -p:TestTargetOS=Windowsnetcoreapp --collect "Code coverage" --results-directory TestResults --filter "category!=failing&category!=flaky&category!=nonnetcoreapptests&category!=nonwindowstests" --logger:"trx;LogFilePrefix=Manual-Windowsnetcoreapp-3" " exited with code 1.

Check failure on line 333 in build.proj

View check run for this annotation

Azure Pipelines / CI-SqlClient-Package (Win11_ARM64_Azure_Sql net9_0_AnyCPU_ManagedSNI_3)

build.proj#L333

build.proj(333,5): Error MSB3073: The command " dotnet test "src\Microsoft.Data.SqlClient\tests\ManualTests\Microsoft.Data.SqlClient.ManualTesting.Tests.csproj" --no-build -v n -p:Configuration=Release -p:TargetnetcoreVersion=net9.0 -p:ReferenceType=Package -p:TestSet=3 -p:TestTargetOS=Windowsnetcoreapp --collect "Code coverage" --results-directory TestResults --filter "category!=failing&category!=flaky&category!=nonnetcoreapptests&category!=nonwindowstests" --logger:"trx;LogFilePrefix=Manual-Windowsnetcoreapp-3" " exited with code 1.

Check failure on line 333 in build.proj

View check run for this annotation

Azure Pipelines / CI-SqlClient-Package (Win11_ARM64_Azure_Sql net8_0_AnyCPU_NativeSNI_3)

build.proj#L333

build.proj(333,5): Error MSB3073: The command " dotnet test "src\Microsoft.Data.SqlClient\tests\ManualTests\Microsoft.Data.SqlClient.ManualTesting.Tests.csproj" --no-build -v n -p:Configuration=Release -p:TargetnetcoreVersion=net8.0 -p:ReferenceType=Package -p:TestSet=3 -p:TestTargetOS=Windowsnetcoreapp --collect "Code coverage" --results-directory TestResults --filter "category!=failing&category!=flaky&category!=nonnetcoreapptests&category!=nonwindowstests" --logger:"trx;LogFilePrefix=Manual-Windowsnetcoreapp-3" " exited with code 1.

Check failure on line 333 in build.proj

View check run for this annotation

Azure Pipelines / CI-SqlClient-Package

build.proj#L333

build.proj(333,5): Error MSB3073: The command " dotnet test "src\Microsoft.Data.SqlClient\tests\ManualTests\Microsoft.Data.SqlClient.ManualTesting.Tests.csproj" --no-build -v n -p:Configuration=Release -p:TargetnetcoreVersion=net8.0 -p:ReferenceType=Package -p:TestSet=3 -p:TestTargetOS=Windowsnetcoreapp --collect "Code coverage" --results-directory TestResults --filter "category=flaky&category!=nonnetcoreapptests&category!=nonwindowstests" --logger:"trx;LogFilePrefix=Manual-Windowsnetcoreapp-3" " exited with code 1.

Check failure on line 333 in build.proj

View check run for this annotation

Azure Pipelines / CI-SqlClient (Win11_ARM64_Azure_Sql net8_0_AnyCPU_ManagedSNI_3)

build.proj#L333

build.proj(333,5): Error MSB3073: The command " dotnet test "src\Microsoft.Data.SqlClient\tests\ManualTests\Microsoft.Data.SqlClient.ManualTesting.Tests.csproj" --no-build -v n -p:Configuration=Release -p:TargetnetcoreVersion=net8.0 -p:ReferenceType=Project -p:TestSet=3 -p:TestTargetOS=Windowsnetcoreapp --collect "Code coverage" --results-directory TestResults --filter "category=flaky&category!=nonnetcoreapptests&category!=nonwindowstests" --logger:"trx;LogFilePrefix=Manual-Windowsnetcoreapp-3" " exited with code 1.

Check failure on line 333 in build.proj

View check run for this annotation

Azure Pipelines / CI-SqlClient (Win11_ARM64_Azure_Sql net462_AnyCPU_3)

build.proj#L333

build.proj(333,5): Error MSB3073: The command " dotnet test "src\Microsoft.Data.SqlClient\tests\ManualTests\Microsoft.Data.SqlClient.ManualTesting.Tests.csproj" --no-build -v n -p:Configuration=Release -p:TargetnetfxVersion=net462 -p:ReferenceType=Project -p:TestSet=3 -p:TestTargetOS=Windowsnetfx --collect "Code coverage" --results-directory TestResults --filter "category=flaky&category!=nonnetfxtests&category!=nonwindowstests" --logger:"trx;LogFilePrefix=Manual-Windowsnetfx-3" " exited with code 1.

Check failure on line 333 in build.proj

View check run for this annotation

Azure Pipelines / CI-SqlClient

build.proj#L333

build.proj(333,5): Error MSB3073: The command " dotnet test "src\Microsoft.Data.SqlClient\tests\ManualTests\Microsoft.Data.SqlClient.ManualTesting.Tests.csproj" --no-build -v n -p:Configuration=Release -p:TargetnetcoreVersion=net8.0 -p:ReferenceType=Project -p:TestSet=3 -p:TestTargetOS=Windowsnetcoreapp --collect "Code coverage" --results-directory TestResults --filter "category=flaky&category!=nonnetcoreapptests&category!=nonwindowstests" --logger:"trx;LogFilePrefix=Manual-Windowsnetcoreapp-3" " exited with code 1.
</Target>

<!-- Run all Manual tests applicable to Unix. -->
Expand All @@ -345,7 +347,7 @@
-p:TestTargetOS=Unixnetcoreapp
--collect "Code coverage"
--results-directory $(ResultsDirectory)
--filter "category!=nonnetcoreapptests&amp;category!=failing&amp;category!=nonlinuxtests&amp;category!=nonuaptests"
--filter "$(Filter)&amp;category!=nonnetcoreapptests&amp;category!=nonlinuxtests&amp;category!=nonuaptests"
--logger:"trx;LogFilePrefix=Manual-Unixnetcoreapp-$(TestSet)"
</TestCommand>
<TestCommand>$(TestCommand.Replace($([System.Environment]::NewLine), " "))</TestCommand>
Expand Down
88 changes: 84 additions & 4 deletions eng/pipelines/common/templates/steps/run-all-tests-step.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,22 @@ steps:
condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT'))
retryCountOnTaskFailure: 1

- task: MSBuild@1
displayName: 'Run Flaky Unit Tests ${{ parameters.msbuildArchitecture }}'
inputs:
solution: build.proj
msbuildArchitecture: ${{parameters.msbuildArchitecture }}
platform: '${{parameters.platform }}'
configuration: '${{parameters.configuration }}'
${{ if eq(parameters.msbuildArchitecture, 'x64') }}:
msbuildArguments: '-t:RunUnitTests -p:TF=${{parameters.targetFramework }} -p:TestMicrosoftDataSqlClientVersion=${{parameters.nugetPackageVersion }} -p:Filter="category=flaky"'
${{ else }}: #x86
msbuildArguments: '-t:RunUnitTests -p:TF=${{parameters.targetFramework }} -p:TestMicrosoftDataSqlClientVersion=${{parameters.nugetPackageVersion }} -p:DotnetPath=${{parameters.dotnetx86RootPath }} -p:Filter="category=flaky"'
Comment thread
paulmedynski marked this conversation as resolved.
verbosityRestore: Detailed
verbosityPack: Detailed
condition: succeededOrFailed()
continueOnError: true

- task: MSBuild@1
displayName: 'Run Functional Tests ${{parameters.msbuildArchitecture }}'
inputs:
Expand All @@ -79,9 +95,23 @@ steps:
msbuildArguments: '-t:RunFunctionalTests -p:TF=${{parameters.targetFramework }} -p:TestSet=${{parameters.testSet }} -p:ReferenceType=${{parameters.referenceType }} -p:TestMicrosoftDataSqlClientVersion=${{parameters.nugetPackageVersion }}'
${{ else }}: # x86
msbuildArguments: '-t:RunFunctionalTests -p:TF=${{parameters.targetFramework }} -p:TestSet=${{parameters.testSet }} -p:ReferenceType=${{parameters.referenceType }} -p:TestMicrosoftDataSqlClientVersion=${{parameters.nugetPackageVersion }} -p:DotnetPath=${{parameters.dotnetx86RootPath }}'
Comment thread
paulmedynski marked this conversation as resolved.
condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT'))
condition: succeededOrFailed()
Comment thread
paulmedynski marked this conversation as resolved.
retryCountOnTaskFailure: 1

- task: MSBuild@1
displayName: 'Run Flaky Functional Tests ${{parameters.msbuildArchitecture }}'
inputs:
solution: build.proj
msbuildArchitecture: ${{parameters.msbuildArchitecture }}
platform: '${{parameters.platform }}'
configuration: '${{parameters.configuration }}'
${{ if eq(parameters.msbuildArchitecture, 'x64') }}:
msbuildArguments: '-t:RunFunctionalTests -p:TF=${{parameters.targetFramework }} -p:TestSet=${{parameters.testSet }} -p:ReferenceType=${{parameters.referenceType }} -p:TestMicrosoftDataSqlClientVersion=${{parameters.nugetPackageVersion }} -p:Filter="category=flaky"'
${{ else }}: # x86
msbuildArguments: '-t:RunFunctionalTests -p:TF=${{parameters.targetFramework }} -p:TestSet=${{parameters.testSet }} -p:ReferenceType=${{parameters.referenceType }} -p:TestMicrosoftDataSqlClientVersion=${{parameters.nugetPackageVersion }} -p:DotnetPath=${{parameters.dotnetx86RootPath }} -p:Filter="category=flaky"'
condition: succeededOrFailed()
Comment thread
paulmedynski marked this conversation as resolved.
continueOnError: true

- task: MSBuild@1
displayName: 'Run Manual Tests ${{parameters.msbuildArchitecture }}'
inputs:
Expand All @@ -93,9 +123,23 @@ steps:
msbuildArguments: '-t:RunManualTests -p:TF=${{parameters.targetFramework }} -p:TestSet=${{parameters.testSet }} -p:ReferenceType=${{parameters.referenceType }} -p:TestMicrosoftDataSqlClientVersion=${{parameters.nugetPackageVersion }}'
${{ else }}: # x86
msbuildArguments: '-t:RunManualTests -p:TF=${{parameters.targetFramework }} -p:TestSet=${{parameters.testSet }} -p:ReferenceType=${{parameters.referenceType }} -p:TestMicrosoftDataSqlClientVersion=${{parameters.nugetPackageVersion }} -p:DotnetPath=${{parameters.dotnetx86RootPath }}'
condition: eq(variables['Agent.OS'], 'Windows_NT')
condition: succeededOrFailed()
retryCountOnTaskFailure: 2

- task: MSBuild@1
displayName: 'Run Flaky Manual Tests ${{parameters.msbuildArchitecture }}'
inputs:
solution: build.proj
msbuildArchitecture: ${{parameters.msbuildArchitecture }}
platform: '${{parameters.platform }}'
configuration: '${{parameters.configuration }}'
${{ if eq(parameters.msbuildArchitecture, 'x64') }}:
msbuildArguments: '-t:RunManualTests -p:TF=${{parameters.targetFramework }} -p:TestSet=${{parameters.testSet }} -p:ReferenceType=${{parameters.referenceType }} -p:TestMicrosoftDataSqlClientVersion=${{parameters.nugetPackageVersion }} -p:Filter="category=flaky"'
${{ else }}: # x86
msbuildArguments: '-t:RunManualTests -p:TF=${{parameters.targetFramework }} -p:TestSet=${{parameters.testSet }} -p:ReferenceType=${{parameters.referenceType }} -p:TestMicrosoftDataSqlClientVersion=${{parameters.nugetPackageVersion }} -p:DotnetPath=${{parameters.dotnetx86RootPath }} -p:Filter="category=flaky"'
Comment thread
paulmedynski marked this conversation as resolved.
condition: succeededOrFailed()
continueOnError: true

- ${{ else }}: # Linux or macOS
- ${{if eq(parameters.referenceType, 'Project')}}:
- task: DotNetCoreCLI@2
Expand All @@ -110,6 +154,18 @@ steps:
retryCountOnTaskFailure: 1
condition: and(succeeded(), ne(variables['Agent.OS'], 'Windows_NT'))

- task: DotNetCoreCLI@2
Comment thread
mdaigle marked this conversation as resolved.
displayName: 'Run Flaky Unit Tests'
inputs:
command: custom
projects: build.proj
custom: msbuild
arguments: '-t:RunUnitTests -p:TF=${{ parameters.targetFramework }} -p:TestSet=${{ parameters.testSet }} -p:TestMicrosoftDataSqlClientVersion=${{ parameters.nugetPackageVersion }} -p:platform=${{ parameters.platform }} -p:Configuration=${{ parameters.configuration }} -p:Filter="category=flaky"'
verbosityRestore: Detailed
verbosityPack: Detailed
condition: succeededOrFailed()
continueOnError: true

- task: DotNetCoreCLI@2
displayName: 'Run Functional Tests'
inputs:
Expand All @@ -120,7 +176,19 @@ steps:
verbosityRestore: Detailed
verbosityPack: Detailed
retryCountOnTaskFailure: 1
condition: and(succeeded(), ne(variables['Agent.OS'], 'Windows_NT'))
condition: succeededOrFailed()

- task: DotNetCoreCLI@2
displayName: 'Run Flaky Functional Tests'
inputs:
command: custom
projects: build.proj
custom: msbuild
arguments: '-t:RunFunctionalTests -p:TF=${{parameters.targetFramework }} -p:TestSet=${{parameters.testSet }} -p:ReferenceType=${{parameters.referenceType }} -p:TestMicrosoftDataSqlClientVersion=${{parameters.nugetPackageVersion }} -p:platform=${{parameters.platform }} -p:Configuration=${{parameters.configuration }} -p:Filter="category=flaky"'
verbosityRestore: Detailed
verbosityPack: Detailed
condition: succeededOrFailed()
continueOnError: true
Comment thread
paulmedynski marked this conversation as resolved.

- task: DotNetCoreCLI@2
displayName: 'Run Manual Tests'
Expand All @@ -132,4 +200,16 @@ steps:
verbosityRestore: Detailed
verbosityPack: Detailed
retryCountOnTaskFailure: 2
condition: and(succeeded(), ne(variables['Agent.OS'], 'Windows_NT'))
condition: succeededOrFailed()

- task: DotNetCoreCLI@2
displayName: 'Run Flaky Manual Tests'
inputs:
command: custom
projects: build.proj
custom: msbuild
arguments: '-t:RunManualTests -p:TF=${{parameters.targetFramework }} -p:TestSet=${{parameters.testSet }} -p:ReferenceType=${{parameters.referenceType }} -p:TestMicrosoftDataSqlClientVersion=${{parameters.nugetPackageVersion }} -p:platform=${{parameters.platform }} -p:Configuration=${{parameters.configuration }} -p:Filter="category=flaky"'
verbosityRestore: Detailed
verbosityPack: Detailed
condition: succeededOrFailed()
continueOnError: true
Comment thread
paulmedynski marked this conversation as resolved.
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,7 @@ public static string CurrentTestName(ITestOutputHelper outputHelper)
return match.Groups[1].Value;
}

// @TODO: Depending on the test runner, ClassName may or may not be populated!
private static readonly Regex TestNameRegex = new(
// Capture the ClassName.MethodName portion, which may terminate
// the name, or have (args...) appended.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,83 @@

namespace Microsoft.Data.SqlClient.ManualTesting.Tests
{
// XEvent sessions may become orphaned on the Azure SQL Server, which leads to poor performance
// (query timeouts, deadlocks, etc) over time. This class is instantiated once per test run and
// drops these orphaned sessions as part of every run to help mitigate this issue.
public class XEventCleaner
{
public XEventCleaner()
{
if (DataTestUtility.AreConnStringsSetup() &&
DataTestUtility.IsNotAzureSynapse() &&
DataTestUtility.IsNotManagedInstance())
{
using SqlConnection connection = new(DataTestUtility.TCPConnectionString);
connection.Open();

// Identify orphaned event sessions and generate DROP commands.
using SqlCommand command = new(
"""
SELECT Sessions.name
FROM sys.database_event_sessions Sessions
LEFT JOIN sys.dm_xe_database_sessions Active ON Sessions.name = Active.name
WHERE Active.name IS NULL;
""",
Comment thread
paulmedynski marked this conversation as resolved.
connection);

HashSet<string> orphanedSessions = new();
try
{
using SqlDataReader reader = command.ExecuteReader();

while (reader.Read())
{
string sessionName = reader.GetString(0);
orphanedSessions.Add(sessionName);
}
}
catch (SqlException)
{
// Ignore exceptions - the next test run will attempt the cleanup.
}

if (orphanedSessions.Count == 0)
{
return;
}

Console.WriteLine($"Identified {orphanedSessions.Count} orphaned XEvent sessions:");

// Drop them one at a time.
foreach (string sessionName in orphanedSessions)
{
using SqlCommand dropCommand = new(
$"DROP EVENT SESSION [{sessionName}] ON DATABASE;",
connection);
Comment thread
paulmedynski marked this conversation as resolved.

try
{
dropCommand.ExecuteNonQuery();
}
catch (SqlException)
{
// Ignore exceptions, as the session may have been cleaned up by another
// test run at the same time.
}

Console.WriteLine($" Dropped orphaned XEvent session: {sessionName}");
Comment thread
paulmedynski marked this conversation as resolved.
}
}
}
}

// This empty class is required by xUnit to tie the cleaner to the test classes.
[CollectionDefinition("XEventCleaner")]
public class XEventCleanerCollection : ICollectionFixture<XEventCleaner>
{
}

[Collection("XEventCleaner")]
public class XEventsTracingTest
{
private readonly string _testName;
Expand All @@ -22,6 +99,7 @@ public XEventsTracingTest(ITestOutputHelper outputHelper)
_testName = DataTestUtility.CurrentTestName(outputHelper);
}

[Trait("Category", "flaky")]
[ConditionalTheory(typeof(DataTestUtility), nameof(DataTestUtility.AreConnStringsSetup), nameof(DataTestUtility.IsNotAzureSynapse), nameof(DataTestUtility.IsNotManagedInstance))]
Comment thread
paulmedynski marked this conversation as resolved.
[InlineData("SELECT @@VERSION", System.Data.CommandType.Text, "sql_statement_starting")]
[InlineData("sp_help", System.Data.CommandType.StoredProcedure, "rpc_starting")]
Expand All @@ -39,7 +117,7 @@ public void XEventActivityIDConsistentWithTracing(string query, System.Data.Comm

using SqlConnection xEventManagementConnection = new(DataTestUtility.TCPConnectionString);
xEventManagementConnection.Open();

using DataTestUtility.XEventScope xEventSession = new(
_testName,
xEventManagementConnection,
Expand Down Expand Up @@ -84,7 +162,7 @@ private static string GetCommandActivityId(string commandText, string eventName,
XPathNavigator? current = statementStartingQuery.Current;
Assert.NotNull(current);
XPathNavigator? activityIdElement = current.SelectSingleNode("action[@name='attach_activity_id_xfer']/value");

Assert.NotNull(activityIdElement);
Assert.NotNull(activityIdElement.Value);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@

namespace Microsoft.Data.SqlClient.UnitTests.SimulatedServerTests
{
[Collection("SimulatedServerTests")]
[Trait("Category", "flaky")]
[Collection("SimulatedServerTests")]
public class ConnectionFailoverTests
{
//TODO parameterize for transient errors
Expand Down
Loading