-
Notifications
You must be signed in to change notification settings - Fork 319
Common Project | Unit Tests #3870
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: main
Are you sure you want to change the base?
Conversation
…owever, many tests are failing due to runtime issues in common project MDS.
…oject, fix resource issues in unit test project.
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 migrates the Unit Test project to reference the common (merged) Microsoft.Data.SqlClient project instead of the separate platform-specific projects (netfx/netcore). The changes introduce a temporary parallel Test Common project to avoid breaking existing Functional and Manual test projects during the migration.
Key Changes:
- Updated Unit Test project to reference the unified MDS project and resolve SNI dependencies via package references
- Added InternalsVisibleTo attribute and resource file configurations to the common MDS project
- Created a temporary Microsoft.Data.SqlClient.TestCommon project that references the unified MDS project
- Refactored test code to improve clarity and remove unnecessary try-catch blocks
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| build.proj | Removed redundant project references from UnitTests ItemGroup since the dependencies are now managed by the test project itself |
| src/Microsoft.Data.SqlClient/src/Microsoft.Data.SqlClient.csproj | Added InternalsVisibleTo for UnitTests assembly and configured embedded resource handling for Strings.resx files |
| src/Microsoft.Data.SqlClient/tests/Common/Microsoft.Data.SqlClient.TestCommon.csproj | New temporary test common project that references the unified MDS project with necessary test dependencies |
| src/Microsoft.Data.SqlClient/tests/UnitTests/Microsoft.Data.SqlClient.UnitTests.csproj | Restructured to reference the unified MDS project, use SNI package references instead of copy targets, and separate dependencies by target framework |
| src/Microsoft.Data.SqlClient/tests/UnitTests/SimulatedServerTests/ConnectionFailoverTests.cs | Improved test code clarity by extracting actions and removing unnecessary try-catch blocks |
| src/Microsoft.Data.SqlClient.sln | Added the new Microsoft.Data.SqlClient.TestCommon project to the solution with build configurations |
src/Microsoft.Data.SqlClient/tests/UnitTests/Microsoft.Data.SqlClient.UnitTests.csproj
Show resolved
Hide resolved
src/Microsoft.Data.SqlClient/tests/UnitTests/Microsoft.Data.SqlClient.UnitTests.csproj
Show resolved
Hide resolved
src/Microsoft.Data.SqlClient/tests/Common/Microsoft.Data.SqlClient.TestCommon.csproj
Show resolved
Hide resolved
src/Microsoft.Data.SqlClient/tests/UnitTests/SimulatedServerTests/ConnectionFailoverTests.cs
Show resolved
Hide resolved
src/Microsoft.Data.SqlClient/tests/UnitTests/Microsoft.Data.SqlClient.UnitTests.csproj
Show resolved
Hide resolved
src/Microsoft.Data.SqlClient/tests/Common/Microsoft.Data.SqlClient.TestCommon.csproj
Show resolved
Hide resolved
src/Microsoft.Data.SqlClient/tests/UnitTests/Microsoft.Data.SqlClient.UnitTests.csproj
Show resolved
Hide resolved
src/Microsoft.Data.SqlClient/tests/UnitTests/Microsoft.Data.SqlClient.UnitTests.csproj
Show resolved
Hide resolved
src/Microsoft.Data.SqlClient/tests/UnitTests/Microsoft.Data.SqlClient.UnitTests.csproj
Show resolved
Hide resolved
src/Microsoft.Data.SqlClient/tests/UnitTests/SimulatedServerTests/ConnectionFailoverTests.cs
Show resolved
Hide resolved
| <NetStandardDriver Include="**/netcore/ref/Microsoft.Data.SqlClient*.csproj" /> | ||
| <AKVProvider Include="**/add-ons/**/AzureKeyVaultProvider/*.csproj" /> | ||
|
|
||
| <UnitTests Include="**/Common/Common.csproj" /> |
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.
I had to include these so that the referenced projects are built and available for the proper target when we build the unit tests project. I'd be happy to get rid of them, but try building unit tests after cleaning the project to make sure everything still works.
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.
Yes, this is something I'm working through right now in the failing build. I ignored the "--no-build" on the dotnet command and it tripped me up.
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.
Solution has been reached! The Run* target is now being used to build the project, so it shouldn't be necessary to include the dependency projects now.
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 6 out of 6 changed files in this pull request and generated 1 comment.
src/Microsoft.Data.SqlClient/tests/Common/Microsoft.Data.SqlClient.TestCommon.csproj
Show resolved
Hide resolved
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 6 out of 6 changed files in this pull request and generated 2 comments.
src/Microsoft.Data.SqlClient/tests/UnitTests/Microsoft.Data.SqlClient.UnitTests.csproj
Show resolved
Hide resolved
af87573 to
6de0ab7
Compare
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 6 out of 6 changed files in this pull request and generated 4 comments.
src/Microsoft.Data.SqlClient/tests/UnitTests/Microsoft.Data.SqlClient.UnitTests.csproj
Show resolved
Hide resolved
src/Microsoft.Data.SqlClient/tests/Common/Microsoft.Data.SqlClient.TestCommon.csproj
Show resolved
Hide resolved
src/Microsoft.Data.SqlClient/tests/Common/Microsoft.Data.SqlClient.TestCommon.csproj
Show resolved
Hide resolved
Codecov Report✅ All modified and coverable lines are covered by tests.
Additional details and impacted files@@ Coverage Diff @@
## main #3870 +/- ##
==========================================
- Coverage 76.68% 69.73% -6.95%
==========================================
Files 269 263 -6
Lines 43246 66170 +22924
==========================================
+ Hits 33163 46144 +12981
- Misses 10083 20026 +9943
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:
|
Description
This PR updates the Unit Test project to point at the common (merged) MDS project. There's some unconventional changes to make this work, though.
How does this impact our pipelines?
No changes were necessary to the CI/PR pipelines. The existing build.proj command for running the Unit Tests continues to work even after changing the MDS target. A small tweak was necessary to ensure that we weren't building unnecessary projects before running the tests, but that's no big issue, afaik. Pipelines should continue to Just Work™️
I considered making new targets in the build2.proj but decided to just get this out first. There's some cruft in the way we call the Unit Tests today, so leaving it as-is isn't making anything worse.
Issues
N/A
Testing
Locally the build.proj targets and running the unit tests inside the IDE still work.