-
Notifications
You must be signed in to change notification settings - Fork 706
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
Update PackageUpdateResource to receive bool to indicate if snupkg are enabled #6249
Conversation
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.
Looks good, but we need tests.
I see you've crossed off the added tests part but there's no justification for missing tests.
https://github.com/NuGet/NuGet.Client/blob/dev/test/NuGet.Clients.FuncTests/NuGet.CommandLine.FuncTest/Commands/PushCommandTest.cs has some tests.
Ideally, we can consider adding these tests to dotnet nuget push
instead.
The setup code should be very similar.
445655c
to
4f0fcc2
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.
I had left some comments, but didn't click submit :D
test/NuGet.Clients.FuncTests/NuGet.CommandLine.FuncTest/Commands/PushCommandTest.cs
Outdated
Show resolved
Hide resolved
test/NuGet.Clients.FuncTests/NuGet.CommandLine.FuncTest/Commands/PushCommandTest.cs
Outdated
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.
lgtm but I'm not an expert on this area
test/NuGet.Clients.FuncTests/NuGet.CommandLine.FuncTest/Commands/PushCommandTest.cs
Outdated
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.
PR Overview
This PR updates the PackageUpdateResource and associated push logic to accept an explicit boolean flag for enabling snupkg pushes, addressing the issue where SymbolPackageUpdateResource may not be available when using a SymbolSource.
- Introduces a new PushAsync method and overloads to control snupkg support explicitly.
- Adds new integration tests in PushCommandTest to validate push behaviors for packages and symbols under various configurations.
- Modifies the setup of mock servers to return the proper push endpoint and updates variable naming in the PushRunner.
Reviewed Changes
File | Description |
---|---|
test/NuGet.Clients.FuncTests/NuGet.CommandLine.FuncTest/Commands/PushCommandTest.cs | Adds tests to verify proper push behavior for packages and snupkgs, and updates the mock server endpoint setup. |
src/NuGet.Core/NuGet.Commands/CommandRunners/PushRunner.cs | Updates the push logic to use an explicit snupkg flag and introduces a variable naming inconsistency. |
src/NuGet.Core/NuGet.Protocol/Resources/PackageUpdateResource.cs | Refactors push methods to accept a bool for snupkg support and deprecates the obsolete overload. |
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Comments suppressed due to low confidence (2)
test/NuGet.Clients.FuncTests/NuGet.CommandLine.FuncTest/Commands/PushCommandTest.cs:1091
- Consider using a proper URL concatenation method (e.g. using UriBuilder or ensuring a trailing slash) to guarantee the returned URI is well-formed.
return server.Uri + "push";
src/NuGet.Core/NuGet.Commands/CommandRunners/PushRunner.cs:57
- The variable name 'symbeSourceUri' appears to contain a typo; consider renaming it to 'symbolSourceUri' for clarity.
var symbeSourceUri = symbolSource;
Bug
Fixes: NuGet/Home#11871
Description
SymbolPackageUpdateResource is currently only being used in PackageUpdateResource to determine if snupkg are enabled for symbol sources. Since the push command allows users to specify a SymbolSource, there may not be a SymbolPackageUpdateResource available. This created a new function which takes in "allowSnupkg" as a parameter instead of trying to determine if it's available based on whether or not SymbolPackageUpdateResource is null.
PR Checklist
Link to an issue or pull request to update docs if this PR changes settings, environment variables, new feature, etc.