Move package compatibility app to tools and add robust test coverage#4242
Move package compatibility app to tools and add robust test coverage#4242paulmedynski wants to merge 9 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
This PR relocates the package-compatibility smoke app into tools/PackageCompatibility and adds an xUnit v3 test suite to validate CLI behavior, App.Run error paths, and MSBuild package-version override/codegen output.
Changes:
- Moved/renamed the compatibility tool and updated namespaces/solution wiring.
- Added MSBuild-driven
PackageVersions.g.csgeneration plus expanded version override support. - Added xUnit v3 tests covering CLI required-args/help output, malformed connection handling, and
-p:override propagation.
Reviewed changes
Copilot reviewed 17 out of 21 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| tools/PackageCompatibility/src/PackageCompatibility.csproj | Renames root namespace, adds package references, and grants InternalsVisibleTo to the new test project. |
| tools/PackageCompatibility/src/App.cs | Updates banner/package reporting and app name; keeps connectivity test behavior. |
| tools/PackageCompatibility/src/EntryPoint.cs | Updates help text and prints additional resolved package versions. |
| tools/PackageCompatibility/src/GeneratePackageVersions.targets | Adds MSBuild target + Roslyn task to generate PackageVersions.g.cs from resolved package versions. |
| tools/PackageCompatibility/src/PackageVersions.Partial.cs | Renames the Azure “N/A” constant and aligns namespace with new tool location. |
| tools/PackageCompatibility/src/SqlClientEventListener.cs | Namespace update to match the new tool location. |
| tools/PackageCompatibility/test/PackageCompatibility.Test.csproj | New xUnit v3 test project targeting net481/net10.0. |
| tools/PackageCompatibility/test/EntryPointTests.cs | New tests for required args and --help output contracts. |
| tools/PackageCompatibility/test/AppTests.cs | New tests for malformed connection-string handling and log-events banner ordering. |
| tools/PackageCompatibility/test/BuildVersionOverrideTests.cs | New hermetic build test validating -p: overrides are reflected in generated version constants. |
| tools/PackageCompatibility/test/ConsoleCollection.cs | Adds a non-parallel xUnit collection for console-mutating tests. |
| tools/PackageCompatibility/Directory.Build.props | Enables CPM for the tool subtree. |
| tools/PackageCompatibility/Directory.Packages.props | Tool-local CPM versions + MSBuild override defaults for package versions. |
| tools/PackageCompatibility/NuGet.config | Adds local packages/ feed for unpublished nupkgs. |
| tools/PackageCompatibility/global.json | Pins SDK and forces Microsoft.Testing.Platform runner within the subtree. |
| tools/PackageCompatibility/README.md | New tool documentation and usage examples. |
| tools/PackageCompatibility/packages/.gitkeep | Ensures packages/ exists for the local NuGet feed. |
| src/Microsoft.Data.SqlClient.slnx | Removes old doc app and adds the tool + test projects to the solution. |
| doc/apps/AzureAuthentication/README.md | Removes the old doc sample app README. |
| doc/apps/AzureAuthentication/Directory.Packages.props | Removes old doc sample’s CPM file. |
| .github/instructions/testing.instructions.md | Adds guidance requiring XML docs on tests/helpers/fixtures. |
Comments suppressed due to low confidence (1)
tools/PackageCompatibility/src/PackageCompatibility.csproj:8
- The project targets net481 unconditionally. This can break cross-platform builds/solution loading on non-Windows hosts (net48* TFMs aren't supported there). The repo convention is to add netfx TFMs only when building on Windows (e.g., src/Microsoft.Data.SqlClient/tests/UnitTests/Microsoft.Data.SqlClient.UnitTests.csproj:12-19). Consider making net481 conditional on '$(OS)' == 'Windows_NT' (or dropping it if not required).
| @@ -0,0 +1,197 @@ | |||
| # PackageCompatibility Tool | |||
There was a problem hiding this comment.
How is it different than running Manual Tests in package reference mode? What's missing in Manual tests (package reference) that this tool will cover?
There was a problem hiding this comment.
Added an explanation in the README.
There was a problem hiding this comment.
But my question was really:
Can this NOT be added to or covered by existing Manual tests? I would avoid creating new projects for individual usecases, and make Manual tests in Package mode cover these cases as well. If it's not POSSIBLE to do so, that's a different thing.
But I don't think its not POSSIBLE to be done within the scope of Manual/Integration testing.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4242 +/- ##
==========================================
- Coverage 66.57% 64.90% -1.67%
==========================================
Files 284 279 -5
Lines 43301 66219 +22918
==========================================
+ Hits 28827 42981 +14154
- Misses 14474 23238 +8764
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:
|
mdaigle
left a comment
There was a problem hiding this comment.
Do you plan to run these on PR/CI builds eventually?
| /// <see cref="System.Console.Error"/> cannot interfere with one another. | ||
| /// </summary> | ||
| [CollectionDefinition(Name, DisableParallelization = true)] | ||
| public sealed class ConsoleCollection : ICollectionFixture<ConsoleCollectionFixture> |
There was a problem hiding this comment.
✏️ you could capture and restore the original out and error as part of this fixture's construct/dispose lifecycle to avoid duplicating setup and tear down in each test.
There was a problem hiding this comment.
Fixed in 311a570: EntryPointTests now implements IDisposable — constructor captures and redirects Console.Out/Console.Error, Dispose() restores them. No more duplicated setup/teardown in each test method.
…zureAuthentication app - Add LoggingVersion and AbstractionsVersion MSBuild properties (default 1.0.0) - Add PackageVersion entries for Microsoft.Data.SqlClient.Internal.Logging and Microsoft.Data.SqlClient.Extensions.Abstractions - Reference both packages explicitly in the project to surface their resolved versions in the generated PackageVersions class - Emit Logging and Abstractions versions alongside the other package versions in App.cs and EntryPoint.cs startup output - Rename PackageVersions.AzureExtensionsVersion to MicrosoftDataSqlClientExtensionsAzureVersion to match the naming pattern used by all other generated version constants - Update README with new build parameters, help-text examples, and sample output
The primary purpose of this app is to test package compatibility, not specifically Azure authentication, so the name now better reflects its purpose. - git mv doc/apps/AzureAuthentication/ tools/PackageCompatibility/ - Rename AzureAuthentication.csproj to PackageCompatibility.csproj - Update RootNamespace and all source namespaces to Microsoft.Data.SqlClient.Tools.PackageCompatibility - Rename AppName constant to 'Package Compatibility Tester' - Update README title, help-text block, and sample output accordingly
- add explicit Microsoft.SqlServer.Server version support and output - keep PackageCompatibility package/version ordering as currently arranged - update help text and sample output for current package version set - expand README guidance around package compatibility and auth flows
- Added support to specify all SqlClient suite package versions. - Added a modern xUnit3 test suite.
- Fix net481 build: add IsExternalInit polyfill, GetRelativePath helper, and Split overload compat for net481 in BuildVersionOverrideTests - Use PackageVersions constants instead of hard-coded version strings in EntryPointTests.HelpOutputContainsDefaultVersions (fix #1) - Fix WaitForExit deadlock risk on net481: read stdout/stderr async before waiting; check timeout bool and kill/throw on expiry (fix #2) - Fix Directory.Packages.props typo: explcitily -> explicitly (fix #4) - Fix README.md typo: -p:SqlServerVersio= -> -p:SqlServerVersion= (fix #5) - Move WaitForCapturedOutput inside try block so late console output is captured before streams are restored (fix #6) - Use ArgumentList on NET and QuoteArgument helper on net481 so paths with spaces are passed correctly to dotnet build (fix #7) - Fix testing.instructions.md list continuation indents (4-space -> 2-space) so GitHub renders them as wrapped text not code blocks (fix #8)
… running manual tests.
ba7bbbb to
cdeb1b1
Compare
…evels, console fixture - Exclude packages/ in ShouldSkip to avoid copying large local .nupkg files; create an empty packages/ dir in the temp workspace for NuGet.config validity. - Add try/finally cleanup of temp build directories (opt-out via PACKAGECOMPATIBILITY_PRESERVE_TEMP env var). - Demote sub-headings under 'Test Documentation Requirements' from ### to #### so they render as subsections of the ### parent. - Move console capture/restore into EntryPointTests constructor/Dispose to eliminate duplicated setup/teardown in each test method.
… root - Remove dead 'bool preserveTemp' in BuildAppWithProperties (cleanup is controlled by the caller's ShouldPreserveTempBuildDirectories() call). - Update tools/PackageCompatibility/global.json SDK version from 10.0.107 to 10.0.300 to match the repo-root global.json.
| A minimal console application that verifies that a set of SqlClient packages can coexist without | ||
| transitive dependency conflicts, API surface mismatches, or broken runtime functionality. It loads | ||
| assemblies from each package and then opens a `SqlConnection` to confirm that the resolved package | ||
| graph works end-to-end against a real SQL Server instance. |
| | SQL Server auth | *(omit or `SqlPassword`)* | `Microsoft.Data.SqlClient` only | | ||
| | Windows / Integrated | `ActiveDirectoryIntegrated` | `Microsoft.Data.SqlClient` + SSPI | | ||
| | Entra ID — default chain | `ActiveDirectoryDefault` | `Microsoft.Data.SqlClient` + `Extensions.Azure` (requires `AzureVersion`) | |
Summary
doc/apps/AzureAuthenticationtotools/PackageCompatibility..github/instructions/testing.instructions.md.Azure.Corepackage version from the local CPM file.Validation
dotnet test -f net10.0intools/PackageCompatibility/test(pass: 8/8)Notes
tools/PackageCompatibility/global.jsonto force Microsoft.Testing.Platform runner for local xUnit v3 compatibility on net10.Maintainer checklist