-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
volume/update: require 1 argument/fix panic
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 <[email protected]>
- Loading branch information
Showing
2 changed files
with
23 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package volume | ||
|
||
import ( | ||
"io" | ||
"testing" | ||
|
||
"github.com/docker/cli/internal/test" | ||
"gotest.tools/v3/assert" | ||
) | ||
|
||
func TestUpdateCmd(t *testing.T) { | ||
cmd := newUpdateCommand( | ||
test.NewFakeCli(&fakeClient{}), | ||
) | ||
cmd.SetArgs([]string{}) | ||
cmd.SetOut(io.Discard) | ||
cmd.SetErr(io.Discard) | ||
|
||
err := cmd.Execute() | ||
|
||
assert.ErrorContains(t, err, "requires 1 argument") | ||
} |