-
Notifications
You must be signed in to change notification settings - Fork 317
Tests | Account for MAX_DISPATCH_LATENCY in XEvents tests #3456
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
Conversation
XEvents are asynchronous, and are written to the target within MAX_DISPATCH_LATENCY seconds. We therefore need to wait that long before querying the target.
|
/azp run |
|
Azure Pipelines successfully started running 2 pipeline(s). |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #3456 +/- ##
==========================================
- Coverage 63.30% 59.62% -3.69%
==========================================
Files 280 274 -6
Lines 62386 62076 -310
==========================================
- Hits 39493 37012 -2481
- Misses 22893 25064 +2171
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:
|
|
/azp run |
|
Azure Pipelines successfully started running 2 pipeline(s). |
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 PR updates XEvents tests to account for the asynchronous dispatch latency by waiting before querying the event target.
- Extracts the dispatch latency into a constant and updates XEvent session settings.
- Inserts a sleep in the test utility to wait for events to be dispatched.
- Refactors
XEventsTracingTestto open the connection early, captureClientConnectionId, and filter XEvents by that ID.
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/Microsoft.Data.SqlClient/tests/ManualTests/TracingTests/XEventsTracingTest.cs | Refactored test setup: open connection first, capture ID, apply filter. |
| src/Microsoft.Data.SqlClient/tests/ManualTests/DataCommon/DataTestUtility.cs | Added MaxXEventsLatencyS constant, replaced hard-coded settings, inserted Thread.Sleep. |
Comments suppressed due to low confidence (1)
src/Microsoft.Data.SqlClient/tests/ManualTests/DataCommon/DataTestUtility.cs:1095
- [nitpick] The suffix 'S' in
MaxXEventsLatencySis ambiguous. Consider renaming toMaxXEventsLatencySecondsfor clarity.
private const int MaxXEventsLatencyS = 5;
src/Microsoft.Data.SqlClient/tests/ManualTests/TracingTests/XEventsTracingTest.cs
Show resolved
Hide resolved
src/Microsoft.Data.SqlClient/tests/ManualTests/DataCommon/DataTestUtility.cs
Show resolved
Hide resolved
* Account for MAX_DISPATCH_LATENCY in XEvents tests XEvents are asynchronous, and are written to the target within MAX_DISPATCH_LATENCY seconds. We therefore need to wait that long before querying the target. * Filter XEvent session by client_connection_id
Description
XEvents are asynchronous, and are written to the target within MAX_DISPATCH_LATENCY seconds. We therefore need to wait that long before querying the target.
Issues
Fixes #3453.
Testing
I've run the corresponding test locally ten times while the SQL Server instance is under load, and this seems to work properly.
Could we run the pipeline a few times to prove the reliability please?