|
|
|
@ -286,6 +286,35 @@ func TestExecErrors(t *testing.T) {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestFailErrors(t *testing.T) {
|
|
|
|
|
vals := chartutil.Values{"Values": map[string]interface{}{}}
|
|
|
|
|
|
|
|
|
|
failtpl := `All your base are belong to us{{ fail "This is an error" }}`
|
|
|
|
|
tplsFailed := map[string]renderable{
|
|
|
|
|
"failtpl": {tpl: failtpl, vals: vals},
|
|
|
|
|
}
|
|
|
|
|
_, err := new(Engine).render(tplsFailed)
|
|
|
|
|
if err == nil {
|
|
|
|
|
t.Fatalf("Expected failures while rendering: %s", err)
|
|
|
|
|
}
|
|
|
|
|
expected := `execution error at (failtpl:1:33): This is an error`
|
|
|
|
|
if err.Error() != expected {
|
|
|
|
|
t.Errorf("Expected '%s', got %q", expected, err.Error())
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var e Engine
|
|
|
|
|
e.LintMode = true
|
|
|
|
|
out, err := e.render(tplsFailed)
|
|
|
|
|
if err != nil {
|
|
|
|
|
t.Fatal(err)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
expectStr := "All your base are belong to us"
|
|
|
|
|
if gotStr := out["failtpl"]; gotStr != expectStr {
|
|
|
|
|
t.Errorf("Expected %q, got %q (%v)", expectStr, gotStr, out)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestAllTemplates(t *testing.T) {
|
|
|
|
|
ch1 := &chart.Chart{
|
|
|
|
|
Metadata: &chart.Metadata{Name: "ch1"},
|
|
|
|
|