mirror of
https://github.com/fluxcd/flux2.git
synced 2026-02-20 22:51:47 +00:00
Fix flux install command so it returns an error when unexpected arguments are passed
Co-authored-by: Max Jonas Werner <makkes@users.noreply.github.com> Signed-off-by: Vinícius Garcia <vingarcia00@gmail.com>
This commit is contained in:
parent
c5b5263b1b
commit
b596aefb91
2 changed files with 6 additions and 0 deletions
|
|
@ -36,6 +36,7 @@ import (
|
||||||
|
|
||||||
var installCmd = &cobra.Command{
|
var installCmd = &cobra.Command{
|
||||||
Use: "install",
|
Use: "install",
|
||||||
|
Args: cobra.NoArgs,
|
||||||
Short: "Install or upgrade Flux",
|
Short: "Install or upgrade Flux",
|
||||||
Long: `The install command deploys Flux in the specified namespace.
|
Long: `The install command deploys Flux in the specified namespace.
|
||||||
If a previous version is installed, then an in-place upgrade will be performed.`,
|
If a previous version is installed, then an in-place upgrade will be performed.`,
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,11 @@ func TestInstall(t *testing.T) {
|
||||||
args: "install --namespace='@#[]'",
|
args: "install --namespace='@#[]'",
|
||||||
assert: assertError("namespace must be a valid DNS label: \"@#[]\""),
|
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 {
|
for _, tt := range tests {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue