-
Notifications
You must be signed in to change notification settings - Fork 737
Factorize PackageDownloadRunner.TryGetRepositoriesForPackage method and add test #6953
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
test/NuGet.Core.FuncTests/NuGet.XPlat.FuncTest/Package/Download/PackageDownloadRunnerTests.cs
Show resolved
Hide resolved
src/NuGet.Core/NuGet.CommandLine.XPlat/Commands/Package/Download/PackageDownloadRunner.cs
Outdated
Show resolved
Hide resolved
14ae511 to
fdc157e
Compare
test/NuGet.Core.FuncTests/NuGet.XPlat.FuncTest/Package/Download/PackageDownloadRunnerTests.cs
Show resolved
Hide resolved
|
@Nigusu-Allehu - How does this implementation differ now from the Restore code path? Any chance of refactoring into a common function? cc @nkolev92 |
Oh yes, a refactoring would definitely be nice. One question I had while looking at this: since both restore's remote walker and this command already share the core mapping logic through After that call, each path just converts source names into its own representation ( Curious what others think. happy to adjust if you see a clean way to unify those parts. |
Yeah, unfortunately any refactoring would probably add complexity, since it'd probably need to use Func or something to choose the comparer and that just adds allocations. |
src/NuGet.Core/NuGet.CommandLine.XPlat/Commands/Package/Download/PackageDownloadRunner.cs
Outdated
Show resolved
Hide resolved
test/NuGet.Core.FuncTests/NuGet.XPlat.FuncTest/Package/Download/PackageDownloadRunnerTests.cs
Outdated
Show resolved
Hide resolved
|
Any tests from the restore implementation that we can copy over or viceversa? In reply to: 3554996830 |
aortiz-msft
left a comment
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.
🕐
Missing in PackageDownloadRunnerTests vs FilterDependencyProvidersForLibraryTests:
Missing in FilterDependencyProvidersForLibraryTests vs PackageDownloadRunnerTests :
|
test/NuGet.Core.FuncTests/NuGet.XPlat.FuncTest/Package/Download/PackageDownloadRunnerTests.cs
Show resolved
Hide resolved
test/NuGet.Core.FuncTests/NuGet.XPlat.FuncTest/Package/Download/PackageDownloadRunnerTests.cs
Outdated
Show resolved
Hide resolved
test/NuGet.Core.FuncTests/NuGet.XPlat.FuncTest/Package/Download/PackageDownloadRunnerTests.cs
Outdated
Show resolved
Hide resolved
test/NuGet.Core.FuncTests/NuGet.XPlat.FuncTest/Package/Download/PackageDownloadRunnerTests.cs
Outdated
Show resolved
Hide resolved
....Tests/NuGet.CommandLine.Xplat.Tests/Commands/Package/Download/PackageDownloadRunnerTests.cs
Outdated
Show resolved
Hide resolved
f3999ed to
62c2dfa
Compare
I'm not seeing tests added to FilterDependencyProvidersForLibraryTests. Could you please add the appropriate tests there as well as part of this PR? |
aortiz-msft
left a comment
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.
See comments
As discussed, offline, added here instead of a separate follow up pr. |
aortiz-msft
left a comment
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.
Approved for now, but refactoring to be done in a separate PR.
Bug
Fixes: https://github.com/NuGet/NuGet.Client/pull/6885/files#r2487713673
Fixes: #6885 (comment)
Description
This PR Factorizes the
PackageDownloadRunner.TryGetRepositoriesForPackagemethod, to improve readability. In addition, it adds one more test scenario for the package download command: " no --source, mapping -> A&B, package in both A and B. Latest version from A installed". In addition, it also addresses a bug where http source validation was not being done for package sources when source mapping is enabled and the package is not mapped to any of the sources.PR Checklist