MCPcopy
hub / github.com/helm/helm / TestRenderDependency

Function TestRenderDependency

pkg/engine/engine_test.go:630–661  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

628}
629
630func TestRenderDependency(t *testing.T) {
631 deptpl := `{{define "myblock"}}World{{end}}`
632 toptpl := `Hello {{template "myblock"}}`
633 modTime := time.Now()
634 ch := &chart.Chart{
635 Metadata: &chart.Metadata{Name: "outerchart"},
636 Templates: []*common.File{
637 {Name: "templates/outer", ModTime: modTime, Data: []byte(toptpl)},
638 },
639 }
640 ch.AddDependency(&chart.Chart{
641 Metadata: &chart.Metadata{Name: "innerchart"},
642 Templates: []*common.File{
643 {Name: "templates/inner", ModTime: modTime, Data: []byte(deptpl)},
644 },
645 })
646
647 out, err := Render(ch, map[string]any{})
648 if err != nil {
649 t.Fatalf("failed to render chart: %s", err)
650 }
651
652 if len(out) != 2 {
653 t.Errorf("Expected 2, got %d", len(out))
654 }
655
656 expect := "Hello World"
657 if out["outerchart/templates/outer"] != expect {
658 t.Errorf("Expected %q, got %q", expect, out["outer"])
659 }
660
661}
662
663func TestRenderNestedValues(t *testing.T) {
664 innerpath := "templates/inner.tpl"

Callers

nothing calls this directly

Calls 4

AddDependencyMethod · 0.95
RenderFunction · 0.85
NowMethod · 0.80
FatalfMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…