Commit e53613db authored by Stefan Deitmer's avatar Stefan Deitmer

Fix subchart values not being deleted by setting value to nil in parent chart's values

Signed-off-by: 's avatarStefan Deitmer <stefan.deitmer@gec.io>
parent 8cacb2c3
scope: spouter
foo: bar
\ No newline at end of file
......@@ -22,3 +22,7 @@ web:
httpGet:
path: /api/v1/info
port: atc
# for testing deleting default values in sub charts
spouter:
foo: null
\ No newline at end of file
......@@ -170,10 +170,7 @@ func CoalesceValues(chrt *chart.Chart, vals *chart.Config) (Values, error) {
if err != nil {
return cvals, err
}
cvals, err = coalesce(chrt, evals)
if err != nil {
return cvals, err
}
return coalesce(chrt, evals)
}
return coalesceDeps(chrt, cvals)
......
......@@ -475,6 +475,33 @@ func TestCoalesceTables(t *testing.T) {
t.Errorf("Expected boat string, got %v", dst["boat"])
}
}
func TestCoalesceSubchart(t *testing.T) {
tchart := "testdata/moby"
c, err := LoadDir(tchart)
if err != nil {
t.Fatal(err)
}
tvals := &chart.Config{}
v, err := CoalesceValues(c, tvals)
if err != nil {
t.Fatal(err)
}
j, _ := json.MarshalIndent(v, "", " ")
t.Logf("Coalesced Values: %s", string(j))
subchartValues, ok := v["spouter"].(map[string]interface{})
if !ok {
t.Errorf("Subchart values not found")
}
if _, ok := subchartValues["foo"]; ok {
t.Errorf("Expected key foo to be removed, still present")
}
}
func TestPathValue(t *testing.T) {
doc := `
title: "Moby Dick"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment