The Wayback Machine - https://web.archive.org/web/20240919233136/https://github.com/docker/cli/pull/5426
Skip to content
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

[27.x backport] volume/update: require 1 argument/fix panic #5426

Merged

Conversation

thaJeztah
Copy link
Member

- What I did

This command was declaring that it requires at least 1 argument, when it needs exactly 1 argument. This was causing the CLI to panic when the command was invoked with no argument.

- How I did it

Require exactly 1 argument.

- How to verify it

  • docker volume update

- Description for the changelog

Fix issue where `docker volume update` command would cause the CLI to panic if no argument/volume was passed.

- A picture of a cute animal (not mandatory but encouraged)

This command was declaring that it requires at least 1 argument, when it
needs exactly 1 argument. This was causing the CLI to panic when the
command was invoked with no argument:

`docker volume update`

Signed-off-by: Laura Brehm <laurabrehm@hey.com>
(cherry picked from commit daea277)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
@thaJeztah thaJeztah added this to the 27.2.2 milestone Sep 11, 2024
@thaJeztah thaJeztah self-assigned this Sep 11, 2024
@codecov-commenter
Copy link

codecov-commenter commented Sep 11, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 59.81%. Comparing base (90559a6) to head (965699b).
Report is 26 commits behind head on 27.x.

Additional details and impacted files
@@            Coverage Diff             @@
##             27.x    #5426      +/-   ##
==========================================
+ Coverage   59.77%   59.81%   +0.04%     
==========================================
  Files         345      345              
  Lines       23405    23396       -9     
==========================================
+ Hits        13990    13994       +4     
+ Misses       8445     8432      -13     
  Partials      970      970              

@thaJeztah
Copy link
Member Author

Ah! Failing because the 27.x branch doesn't have some of the UX improvements we made;

59.13 === FAIL: cli/command/volume TestUpdateCmd (0.00s)
59.13     update_test.go:21: assertion failed: expected error to contain "requires 1 argument", got "\"update\" requires exactly 1 argument.\nSee 'update --help'.\n\nUsage:  update [OPTIONS] [VOLUME] [flags]\n\nUpdate a volume (cluster volumes only)"

The error-message changed in newer versions, and no longer includes
"exactly".

This patch adjusts the test in the meantime.

    59.13 === FAIL: cli/command/volume TestUpdateCmd (0.00s)
    59.13     update_test.go:21: assertion failed: expected error to contain "requires 1 argument", got "\"update\" requires exactly 1 argument.\nSee 'update --help'.\n\nUsage:  update [OPTIONS] [VOLUME] [flags]\n\nUpdate a volume (cluster volumes only)"

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
@thaJeztah
Copy link
Member Author

I pushed a commit to adjust the test for now. We can revert that commit it we decide to backport the improvements.

@laurazard
Copy link
Member

Sounds good to me, thanks for taking care of this!

@laurazard laurazard merged commit fba240c into docker:27.x Sep 11, 2024
87 checks passed
@thaJeztah thaJeztah deleted the 27.x_backport_fix-panic-volume-update branch September 11, 2024 15:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants