diff --git a/pkg/action/action_test.go b/pkg/action/action_test.go index a5baec97d..d0d4875b0 100644 --- a/pkg/action/action_test.go +++ b/pkg/action/action_test.go @@ -229,6 +229,16 @@ func withSampleTemplates() chartOption { } } +func withTemplatesValues() chartOption { + return func(opts *chartOptions) { + sampleTemplates := []*chart.File{ + // This adds basic templates and partials. + {Name: "templates/with-values", Data: []byte("hello: {{ .Values.test.value }}")}, + } + opts.Templates = append(opts.Templates, sampleTemplates...) + } +} + func withMultipleManifestTemplate() chartOption { return func(opts *chartOptions) { sampleTemplates := []*chart.File{ diff --git a/pkg/action/install_test.go b/pkg/action/install_test.go index 4637a4b10..93712a455 100644 --- a/pkg/action/install_test.go +++ b/pkg/action/install_test.go @@ -111,6 +111,17 @@ func TestInstallReleaseWithValues(t *testing.T) { is.Equal(expectedUserValues, rel.Config) } +func TestInstallReleaseWithoutValues(t *testing.T) { + instAction := installAction(t) + chrt := buildChart(withTemplatesValues()) + _, err := instAction.Run(chrt, nil) + if err == nil { + t.Fatal("expected failure when no name is specified") + } + + assert.Contains(t, err.Error(), "failed to render resource: lack of values.yaml") +} + func TestInstallReleaseClientOnly(t *testing.T) { is := assert.New(t) instAction := installAction(t)