| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -230,6 +230,20 @@ func withSampleTemplates() chartOption { | |||
| 230 | 230 | } | |
| 231 | 231 | } | |
| 232 | 232 | ||
| 233 | + func withSampleIncludingIncorrectTemplates() chartOption { | ||
| 234 | + return func(opts *chartOptions) { | ||
| 235 | + sampleTemplates := []*chart.File{ | ||
| 236 | + // This adds basic templates and partials. | ||
| 237 | + {Name: "templates/goodbye", Data: []byte("goodbye: world")}, | ||
| 238 | + {Name: "templates/empty", Data: []byte("")}, | ||
| 239 | + {Name: "templates/incorrect", Data: []byte("{{ .Values.bad.doh }}")}, | ||
| 240 | + {Name: "templates/with-partials", Data: []byte(`hello: {{ template "_planet" . }}`)}, | ||
| 241 | + {Name: "templates/partials/_planet", Data: []byte(`{{define "_planet"}}Earth{{end}}`)}, | ||
| 242 | + } | ||
| 243 | + opts.Templates = append(opts.Templates, sampleTemplates...) | ||
| 244 | + } | ||
| 245 | + } | ||
| 246 | + | ||
| 233 | 247 | func withMultipleManifestTemplate() chartOption { | |
| 234 | 248 | return func(opts *chartOptions) { | |
| 235 | 249 | sampleTemplates := []*chart.File{ | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -460,7 +460,7 @@ func (c *Configuration) renderResources(ch *chart.Chart, values chartutil.Values | |||
| 460 | 460 | } | |
| 461 | 461 | ||
| 462 | 462 | if err2 != nil { | |
| 463 | - return hs, b, "", err | ||
| 463 | + return hs, b, "", err2 | ||
| 464 | 464 | } | |
| 465 | 465 | ||
| 466 | 466 | // NOTES.txt gets rendered like all the other files, but because it's not a hook nor a resource, | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -240,6 +240,21 @@ func TestInstallRelease_DryRun(t *testing.T) { | |||
| 240 | 240 | is.Equal(res.Info.Description, "Dry run complete") | |
| 241 | 241 | } | |
| 242 | 242 | ||
| 243 | + func TestInstallReleaseIncorrectTemplate_DryRun(t *testing.T) { | ||
| 244 | + is := assert.New(t) | ||
| 245 | + instAction := installAction(t) | ||
| 246 | + instAction.DryRun = true | ||
| 247 | + vals := map[string]interface{}{} | ||
| 248 | + _, err := instAction.Run(buildChart(withSampleIncludingIncorrectTemplates()), vals) | ||
| 249 | + expectedErr := "\"hello/templates/incorrect\" at <.Values.bad.doh>: nil pointer evaluating interface {}.doh" | ||
| 250 | + if err == nil { | ||
| 251 | + t.Fatalf("Install should fail containing error: %s", expectedErr) | ||
| 252 | + } | ||
| 253 | + if err != nil { | ||
| 254 | + is.Contains(err.Error(), expectedErr) | ||
| 255 | + } | ||
| 256 | + } | ||
| 257 | + | ||
| 243 | 258 | func TestInstallRelease_NoHooks(t *testing.T) { | |
| 244 | 259 | is := assert.New(t) | |
| 245 | 260 | instAction := installAction(t) | |
| Back | FazBrowse Home | New Git URL |
0 commit comments