dotnet / SqlClient

Microsoft.Data.SqlClient provides database connectivity to SQL Server for .NET applications.
MIT License
859 stars 288 forks source link

Fix SqlBatch Test Deadlocks #3025

Open MichelZ opened 1 day ago

MichelZ commented 1 day ago

AI Blurp

This pull request includes changes to the BatchTests.cs file to add retry logic for SQL commands and to enhance the SqlBatchCommand functionality. The most important changes are as follows:

Enhancements to SQL retry logic:

Improvements to SqlBatchCommand:

Additional imports:

Description

I regularly see deadlocks for the tests that use sp_help. I'll try to mitigate this in 2 different ways:

It can probably also be solved by just using another stored procedure that's not prone to deadlocks, but I chose this way as the easiest path

Example test failure: https://sqlclientdrivers.visualstudio.com/public/_build/results?buildId=101959&view=logs&j=700ebecb-e440-5400-66bb-488206e790af&t=d8ae6a68-b967-5b1e-ef3d-1b53d82075ee&l=826

codecov[bot] commented 1 day ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 72.68%. Comparing base (b1f7eaf) to head (4ab317f). Report is 4 commits behind head on main.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #3025 +/- ## ========================================== - Coverage 72.68% 72.68% -0.01% ========================================== Files 285 285 Lines 59155 59160 +5 ========================================== + Hits 42998 43000 +2 - Misses 16157 16160 +3 ``` | [Flag](https://app.codecov.io/gh/dotnet/SqlClient/pull/3025/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dotnet) | Coverage Δ | | |---|---|---| | [addons](https://app.codecov.io/gh/dotnet/SqlClient/pull/3025/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dotnet) | `92.58% <ø> (ø)` | | | [netcore](https://app.codecov.io/gh/dotnet/SqlClient/pull/3025/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dotnet) | `75.44% <ø> (+0.05%)` | :arrow_up: | | [netfx](https://app.codecov.io/gh/dotnet/SqlClient/pull/3025/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dotnet) | `71.07% <ø> (-0.06%)` | :arrow_down: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dotnet#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.


🚨 Try these New Features: