(t *testing.T)
| 661 | } |
| 662 | |
| 663 | func TestRenderNestedValues(t *testing.T) { |
| 664 | innerpath := "templates/inner.tpl" |
| 665 | outerpath := "templates/outer.tpl" |
| 666 | // Ensure namespacing rules are working. |
| 667 | deepestpath := "templates/inner.tpl" |
| 668 | checkrelease := "templates/release.tpl" |
| 669 | // Ensure subcharts scopes are working. |
| 670 | subchartspath := "templates/subcharts.tpl" |
| 671 | |
| 672 | modTime := time.Now() |
| 673 | deepest := &chart.Chart{ |
| 674 | Metadata: &chart.Metadata{Name: "deepest"}, |
| 675 | Templates: []*common.File{ |
| 676 | {Name: deepestpath, ModTime: modTime, Data: []byte(`And this same {{.Values.what}} that smiles {{.Values.global.when}}`)}, |
| 677 | {Name: checkrelease, ModTime: modTime, Data: []byte(`Tomorrow will be {{default "happy" .Release.Name }}`)}, |
| 678 | }, |
| 679 | Values: map[string]any{"what": "milkshake", "where": "here"}, |
| 680 | } |
| 681 | |
| 682 | inner := &chart.Chart{ |
| 683 | Metadata: &chart.Metadata{Name: "herrick"}, |
| 684 | Templates: []*common.File{ |
| 685 | {Name: innerpath, ModTime: modTime, Data: []byte(`Old {{.Values.who}} is still a-flyin'`)}, |
| 686 | }, |
| 687 | Values: map[string]any{"who": "Robert", "what": "glasses"}, |
| 688 | } |
| 689 | inner.AddDependency(deepest) |
| 690 | |
| 691 | outer := &chart.Chart{ |
| 692 | Metadata: &chart.Metadata{Name: "top"}, |
| 693 | Templates: []*common.File{ |
| 694 | {Name: outerpath, ModTime: modTime, Data: []byte(`Gather ye {{.Values.what}} while ye may`)}, |
| 695 | {Name: subchartspath, ModTime: modTime, Data: []byte(`The glorious Lamp of {{.Subcharts.herrick.Subcharts.deepest.Values.where}}, the {{.Subcharts.herrick.Values.what}}`)}, |
| 696 | }, |
| 697 | Values: map[string]any{ |
| 698 | "what": "stinkweed", |
| 699 | "who": "me", |
| 700 | "herrick": map[string]any{ |
| 701 | "who": "time", |
| 702 | "what": "Sun", |
| 703 | }, |
| 704 | }, |
| 705 | } |
| 706 | outer.AddDependency(inner) |
| 707 | |
| 708 | injValues := map[string]any{ |
| 709 | "what": "rosebuds", |
| 710 | "herrick": map[string]any{ |
| 711 | "deepest": map[string]any{ |
| 712 | "what": "flower", |
| 713 | "where": "Heaven", |
| 714 | }, |
| 715 | }, |
| 716 | "global": map[string]any{ |
| 717 | "when": "to-day", |
| 718 | }, |
| 719 | } |
| 720 |
nothing calls this directly
no test coverage detected
searching dependent graphs…