Skip to content

Commit

Permalink
Fix flux install command so it returns an error when unexpected argum…
Browse files Browse the repository at this point in the history
…ents are passed

    Co-authored-by: Max Jonas Werner <makkes@users.noreply.github.com>
    Signed-off-by: Vinícius Garcia <vingarcia00@gmail.com>
  • Loading branch information
VinGarcia committed Nov 17, 2023
1 parent e645402 commit e7272b4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions cmd/flux/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import (

var installCmd = &cobra.Command{
Use: "install",
Args: cobra.NoArgs,
Short: "Install or upgrade Flux",
Long: `The install command deploys Flux in the specified namespace.
If a previous version is installed, then an in-place upgrade will be performed.`,
Expand Down
5 changes: 5 additions & 0 deletions cmd/flux/install_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ func TestInstall(t *testing.T) {
args: "install --namespace='@#[]'",
assert: assertError("namespace must be a valid DNS label: \"@#[]\""),
},
{
name: "invalid sub-command",
args: "install unexpectedPosArg --namespace=example",
assert: assertError(`unknown command "unexpectedPosArg" for "flux install"`),
},
}

for _, tt := range tests {
Expand Down

0 comments on commit e7272b4

Please sign in to comment.