-
Notifications
You must be signed in to change notification settings - Fork 317
[6.1] Fix xevent test failures, avoid orphaned sessions #3817
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: release/6.1
Are you sure you want to change the base?
Conversation
- Added IsNotManagedInstance() for XEvents tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This pull request ports fixes from #3775 to the release/6.1 branch, addressing XEvent test failures and preventing orphaned XEvent sessions in test environments. The changes refactor the XEventScope test utility to include test names in session identifiers, add automatic session expiration for supported SQL Server versions, and convert affected test classes from static to instance-based to enable test name tracking.
Key changes:
- Refactored
XEventScopeto accept test name as first parameter and added MAX_DURATION support for Azure SQL and SQL Server 2025+ - Converted
XEventsTracingTestandDataStreamTestfrom static to instance-based classes withITestOutputHelperconstructors - Introduced
CurrentTestName()utility method using reflection to extract test names from xUnit's internal structures - Refactored
GetSqlServerProperty()to use aServerPropertyenum instead of string parameters
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 7 comments.
| File | Description |
|---|---|
| src/Microsoft.Data.SqlClient/tests/ManualTests/TracingTests/XEventsTracingTest.cs | Converted class to instance-based, added constructor with ITestOutputHelper, updated XEventScope usage to pass test name, added nullable annotations |
| src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/DataStreamTest/DataStreamTest.cs | Converted class to instance-based, added constructor with ITestOutputHelper, updated XEventScope usage with test name and explicit connection opening, flattened using statements |
| src/Microsoft.Data.SqlClient/tests/ManualTests/DataCommon/DataTestUtility.cs | Added CurrentTestName() method with regex parsing, added ServerProperty enum, refactored GetSqlServerProperty() to use enum, added IsNotManagedInstance() method, enhanced XEventScope with test name parameter, MAX_DURATION support, and improved documentation |
You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.
src/Microsoft.Data.SqlClient/tests/ManualTests/DataCommon/DataTestUtility.cs
Show resolved
Hide resolved
src/Microsoft.Data.SqlClient/tests/ManualTests/DataCommon/DataTestUtility.cs
Show resolved
Hide resolved
src/Microsoft.Data.SqlClient/tests/ManualTests/DataCommon/DataTestUtility.cs
Show resolved
Hide resolved
src/Microsoft.Data.SqlClient/tests/ManualTests/DataCommon/DataTestUtility.cs
Show resolved
Hide resolved
src/Microsoft.Data.SqlClient/tests/ManualTests/DataCommon/DataTestUtility.cs
Show resolved
Hide resolved
src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/DataStreamTest/DataStreamTest.cs
Show resolved
Hide resolved
src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/DataStreamTest/DataStreamTest.cs
Show resolved
Hide resolved
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## release/6.1 #3817 +/- ##
===============================================
+ Coverage 65.27% 66.11% +0.83%
===============================================
Files 279 279
Lines 61765 53290 -8475
===============================================
- Hits 40319 35234 -5085
+ Misses 21446 18056 -3390
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| } | ||
|
|
||
| private static void RunAllTestsForSingleServer(string connectionString, bool usingNamePipes = false) | ||
| // @TODO: Split into separate tests! |
Copilot
AI
Dec 4, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Minor style preference: The TODO format @TODO is non-standard. Most C# codebases use // TODO: (without the @ prefix) which is recognized by most IDEs and task tracking tools. Consider changing to // TODO: for better tool integration.
| // @TODO: Split into separate tests! | |
| // TODO: Split into separate tests! |
Description
Port of #3775 and #3819 to release/6.1