-
Notifications
You must be signed in to change notification settings - Fork 336
[SqlClient] Unify .NET/.NET Framework tests #2850
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
[SqlClient] Unify .NET/.NET Framework tests #2850
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
✅ All tests successful. No failed tests found. Additional details and impacted files@@ Coverage Diff @@
## main #2850 +/- ##
===========================================
+ Coverage 73.91% 88.26% +14.34%
===========================================
Files 267 9 -258
Lines 9615 460 -9155
===========================================
- Hits 7107 406 -6701
+ Misses 2508 54 -2454
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
@@ -27,22 +27,19 @@ public SqlClientIntegrationTests(SqlClientIntegrationTestsFixture fixture) | |||
[InlineData(CommandType.Text, "select 1/1")] | |||
[InlineData(CommandType.Text, "select 1/1", true, "select ?/?")] | |||
[InlineData(CommandType.Text, "select 1/0", false, null, true)] | |||
[InlineData(CommandType.Text, "select 1/0", false, null, true, false, false)] | |||
[InlineData(CommandType.Text, "select 1/0", false, null, true, true, false)] | |||
[InlineData(CommandType.Text, "select 1/0", false, null, true, true)] |
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.
Do you get the same failure locally as I get as fixed in #2826?
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.
No, these tests were running fine for me on a Windows 11 machine. A test case was removed here because I removed the shouldEnrich
parameter. I do not feel that it is important that this integration test tests enrich. We have that coverage elsewhere.
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 unifies the testing suite for SqlClient across both .NET and .NET Framework, consolidating test logic and configurations for improved consistency and maintainability.
- Refactor test classes to use a unified mechanism via the SqlClientLibrary enum.
- Update JSON test cases with separate expected values for NET Framework.
- Introduce separate mock command executor implementations for NET Framework and non-NET Framework environments.
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
test/OpenTelemetry.Instrumentation.SqlClient.Tests/SqlClientTraceInstrumentationOptionsTests.cs | Added tests verifying instrumentation options and telemetry behavior using new configuration patterns. |
test/OpenTelemetry.Instrumentation.SqlClient.Tests/SqlClientTests.cs | Refactored test method names to use the SqlClientLibrary enum and removed redundant tests. |
test/OpenTelemetry.Instrumentation.SqlClient.Tests/SqlClientTestCases.json | Updated test cases to include expectedNetFramework properties for NET Framework. |
test/OpenTelemetry.Instrumentation.SqlClient.Tests/SqlClientTestCases.cs | Integrated conditional mapping of expected values for NET Framework and combined test case definitions. |
test/OpenTelemetry.Instrumentation.SqlClient.Tests/SqlClientIntegrationTests.cs | Adjusted test signature by removing the shouldEnrich parameter and updating activity verification calls. |
test/OpenTelemetry.Instrumentation.SqlClient.Tests/MockCommandExecutor.netfx.cs | Added a NET Framework–specific mock command executor using fake event sources. |
test/OpenTelemetry.Instrumentation.SqlClient.Tests/MockCommandExecutor.cs | Added a common mock command executor for non-NET Framework implementations. |
Comments suppressed due to low confidence (2)
test/OpenTelemetry.Instrumentation.SqlClient.Tests/SqlClientTests.cs:29
- Consider adding a clear comment explaining the rationale for suppressing finalization in Dispose to improve maintainability.
// TODO: Why is this here? Add comment explaining why.
test/OpenTelemetry.Instrumentation.SqlClient.Tests/SqlClientTestCases.cs:36
- [nitpick] Consider adding a comment here to explain why expected values are remapped for NET Framework to aid future maintainers.
#if NETFRAMEWORK
Another PR bringing some sanity to SqlClient tests. The main purpose is to leverage the same test suite introduced in #2798 for .NET Framework.