MCPcopy Index your code
hub / github.com/helm/helm / TestTable

Function TestTable

pkg/chart/common/values_test.go:99–136  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

97}
98
99func TestTable(t *testing.T) {
100 doc := `
101title: "Moby Dick"
102chapter:
103 one:
104 title: "Loomings"
105 two:
106 title: "The Carpet-Bag"
107 three:
108 title: "The Spouter Inn"
109`
110 d, err := ReadValues([]byte(doc))
111 if err != nil {
112 t.Fatalf("Failed to parse the White Whale: %s", err)
113 }
114
115 if _, err := d.Table("title"); err == nil {
116 t.Fatal("Title is not a table.")
117 }
118
119 if _, err := d.Table("chapter"); err != nil {
120 t.Fatalf("Failed to get the chapter table: %s\n%v", err, d)
121 }
122
123 if v, err := d.Table("chapter.one"); err != nil {
124 t.Errorf("Failed to get chapter.one: %s", err)
125 } else if v["title"] != "Loomings" {
126 t.Errorf("Unexpected title: %s", v["title"])
127 }
128
129 if _, err := d.Table("chapter.three"); err != nil {
130 t.Errorf("Chapter three is missing: %s\n%v", err, d)
131 }
132
133 if _, err := d.Table("chapter.OneHundredThirtySix"); err == nil {
134 t.Error("I think you mean 'Epilogue'")
135 }
136}
137
138func matchValues(t *testing.T, data map[string]any) {
139 t.Helper()

Callers

nothing calls this directly

Calls 5

ReadValuesFunction · 0.85
FatalfMethod · 0.80
TableMethod · 0.80
FatalMethod · 0.80
ErrorMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…