mirror of
https://github.com/helm/helm.git
synced 2026-05-28 04:35:48 -04:00
Merge pull request #7596 from hickeyma/fix-no-err-output
fix(render): Render error not being propagated
This commit is contained in:
commit
5ecf3fc099
3 changed files with 30 additions and 1 deletions
|
|
@ -230,6 +230,20 @@ func withSampleTemplates() chartOption {
|
|||
}
|
||||
}
|
||||
|
||||
func withSampleIncludingIncorrectTemplates() chartOption {
|
||||
return func(opts *chartOptions) {
|
||||
sampleTemplates := []*chart.File{
|
||||
// This adds basic templates and partials.
|
||||
{Name: "templates/goodbye", Data: []byte("goodbye: world")},
|
||||
{Name: "templates/empty", Data: []byte("")},
|
||||
{Name: "templates/incorrect", Data: []byte("{{ .Values.bad.doh }}")},
|
||||
{Name: "templates/with-partials", Data: []byte(`hello: {{ template "_planet" . }}`)},
|
||||
{Name: "templates/partials/_planet", Data: []byte(`{{define "_planet"}}Earth{{end}}`)},
|
||||
}
|
||||
opts.Templates = append(opts.Templates, sampleTemplates...)
|
||||
}
|
||||
}
|
||||
|
||||
func withMultipleManifestTemplate() chartOption {
|
||||
return func(opts *chartOptions) {
|
||||
sampleTemplates := []*chart.File{
|
||||
|
|
|
|||
|
|
@ -460,7 +460,7 @@ func (c *Configuration) renderResources(ch *chart.Chart, values chartutil.Values
|
|||
}
|
||||
|
||||
if err2 != nil {
|
||||
return hs, b, "", err
|
||||
return hs, b, "", err2
|
||||
}
|
||||
|
||||
// NOTES.txt gets rendered like all the other files, but because it's not a hook nor a resource,
|
||||
|
|
|
|||
|
|
@ -240,6 +240,21 @@ func TestInstallRelease_DryRun(t *testing.T) {
|
|||
is.Equal(res.Info.Description, "Dry run complete")
|
||||
}
|
||||
|
||||
func TestInstallReleaseIncorrectTemplate_DryRun(t *testing.T) {
|
||||
is := assert.New(t)
|
||||
instAction := installAction(t)
|
||||
instAction.DryRun = true
|
||||
vals := map[string]interface{}{}
|
||||
_, err := instAction.Run(buildChart(withSampleIncludingIncorrectTemplates()), vals)
|
||||
expectedErr := "\"hello/templates/incorrect\" at <.Values.bad.doh>: nil pointer evaluating interface {}.doh"
|
||||
if err == nil {
|
||||
t.Fatalf("Install should fail containing error: %s", expectedErr)
|
||||
}
|
||||
if err != nil {
|
||||
is.Contains(err.Error(), expectedErr)
|
||||
}
|
||||
}
|
||||
|
||||
func TestInstallRelease_NoHooks(t *testing.T) {
|
||||
is := assert.New(t)
|
||||
instAction := installAction(t)
|
||||
|
|
|
|||
Loading…
Reference in a new issue