Skip to content

Conversation

@paulmedynski
Copy link
Contributor

@paulmedynski paulmedynski commented Dec 1, 2025

Description

Port of #3775 and #3819 to release/6.1

  • Added max event session duration where that feature is supported.
  • Added test name to event session name.
  • Flattened using blocks to statements.
  • Applied single-branch config to the approver policy (an unrelated change).
  • Applied CodeQL workflow config specific to release/6.1 branch.

@paulmedynski paulmedynski added this to the 6.1.4 milestone Dec 1, 2025
Copilot AI review requested due to automatic review settings December 1, 2025 18:10
@paulmedynski paulmedynski requested a review from a team as a code owner December 1, 2025 18:10
Copilot finished reviewing on behalf of paulmedynski December 1, 2025 18:14
Copy link
Contributor

Copilot AI left a 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 XEventScope to accept test name as first parameter and added MAX_DURATION support for Azure SQL and SQL Server 2025+
  • Converted XEventsTracingTest and DataStreamTest from static to instance-based classes with ITestOutputHelper constructors
  • Introduced CurrentTestName() utility method using reflection to extract test names from xUnit's internal structures
  • Refactored GetSqlServerProperty() to use a ServerProperty enum 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.

@codecov
Copy link

codecov bot commented Dec 1, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 66.11%. Comparing base (b21442d) to head (6d49498).
⚠️ Report is 1 commits behind head on release/6.1.

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     
Flag Coverage Δ
addons 90.82% <ø> (ø)
netcore 72.61% <ø> (+3.30%) ⬆️
netfx 65.84% <ø> (-1.16%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

mdaigle
mdaigle previously approved these changes Dec 1, 2025
mdaigle
mdaigle previously approved these changes Dec 4, 2025
Copilot AI review requested due to automatic review settings December 4, 2025 18:37
Copilot finished reviewing on behalf of paulmedynski December 4, 2025 18:43
Copy link
Contributor

Copilot AI left a 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!
Copy link

Copilot AI Dec 4, 2025

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.

Suggested change
// @TODO: Split into separate tests!
// TODO: Split into separate tests!

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants