mirror of
https://github.com/helm/helm.git
synced 2026-08-05 23:51:03 +00:00
Merge pull request #7240 from Blokje5/fix/incorrect-error-message-in-helm-install
fix(helm): Validate number of arguments in install client
This commit is contained in:
@@ -555,6 +555,10 @@ func (i *Install) NameAndChart(args []string) (string, string, error) {
|
||||
return nil
|
||||
}
|
||||
|
||||
if len(args) > 2 {
|
||||
return args[0], args[1], errors.Errorf("expected at most two arguments, unexpected arguments: %v", strings.Join(args[2:], ", "))
|
||||
}
|
||||
|
||||
if len(args) == 2 {
|
||||
return args[0], args[1], flagsNotSet()
|
||||
}
|
||||
|
||||
@@ -505,6 +505,14 @@ func TestNameAndChart(t *testing.T) {
|
||||
t.Fatal("expected an error")
|
||||
}
|
||||
is.Equal("must either provide a name or specify --generate-name", err.Error())
|
||||
|
||||
instAction.NameTemplate = ""
|
||||
instAction.ReleaseName = ""
|
||||
_, _, err = instAction.NameAndChart([]string{"foo", chartName, "bar"})
|
||||
if err == nil {
|
||||
t.Fatal("expected an error")
|
||||
}
|
||||
is.Equal("expected at most two arguments, unexpected arguments: bar", err.Error())
|
||||
}
|
||||
|
||||
func TestNameAndChartGenerateName(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user