mirror of
https://github.com/helm/helm.git
synced 2026-04-28 17:49:47 -04:00
Tests for bugfix: Override subcharts with null values #12879
- Add consistency for null test in given values, parent chart, subchart, and sub-sub-chart - Remove bar null test to keep consistent with boat=null at top level Signed-off-by: Scott Rigby <scott@r6by.com>
This commit is contained in:
parent
5a58751a05
commit
60fcce18d1
1 changed files with 23 additions and 5 deletions
|
|
@ -44,6 +44,7 @@ global:
|
|||
boat: true
|
||||
|
||||
pequod:
|
||||
boat: null
|
||||
global:
|
||||
name: Stinky
|
||||
harpooner: Tashtego
|
||||
|
|
@ -55,7 +56,7 @@ pequod:
|
|||
boat: null
|
||||
nested:
|
||||
foo: true
|
||||
bar: null
|
||||
boat: null
|
||||
`)
|
||||
|
||||
func withDeps(c *chart.Chart, deps ...*chart.Chart) *chart.Chart {
|
||||
|
|
@ -82,6 +83,13 @@ func TestCoalesceValues(t *testing.T) {
|
|||
"global": map[string]interface{}{
|
||||
"nested2": map[string]interface{}{"l0": "moby"},
|
||||
},
|
||||
"pequod": map[string]interface{}{
|
||||
"boat": "maybe",
|
||||
"ahab": map[string]interface{}{
|
||||
"boat": "maybe",
|
||||
"nested": map[string]interface{}{"boat": "maybe"},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
withDeps(&chart.Chart{
|
||||
|
|
@ -92,6 +100,11 @@ func TestCoalesceValues(t *testing.T) {
|
|||
"global": map[string]interface{}{
|
||||
"nested2": map[string]interface{}{"l1": "pequod"},
|
||||
},
|
||||
"boat": false,
|
||||
"ahab": map[string]interface{}{
|
||||
"boat": false,
|
||||
"nested": map[string]interface{}{"boat": false},
|
||||
},
|
||||
},
|
||||
},
|
||||
&chart.Chart{
|
||||
|
|
@ -104,7 +117,7 @@ func TestCoalesceValues(t *testing.T) {
|
|||
"scope": "ahab",
|
||||
"name": "ahab",
|
||||
"boat": true,
|
||||
"nested": map[string]interface{}{"foo": false, "bar": true},
|
||||
"nested": map[string]interface{}{"foo": false, "boat": true},
|
||||
},
|
||||
},
|
||||
),
|
||||
|
|
@ -200,13 +213,18 @@ func TestCoalesceValues(t *testing.T) {
|
|||
t.Error("Expected nested boat key to be removed, still present")
|
||||
}
|
||||
|
||||
subchart := v["pequod"].(map[string]interface{})["ahab"].(map[string]interface{})
|
||||
subchart := v["pequod"].(map[string]interface{})
|
||||
if _, ok := subchart["boat"]; ok {
|
||||
t.Error("Expected subchart boat key to be removed, still present")
|
||||
}
|
||||
|
||||
if _, ok := subchart["nested"].(map[string]interface{})["bar"]; ok {
|
||||
t.Error("Expected subchart nested bar key to be removed, still present")
|
||||
subsubchart := subchart["ahab"].(map[string]interface{})
|
||||
if _, ok := subsubchart["boat"]; ok {
|
||||
t.Error("Expected sub-subchart ahab boat key to be removed, still present")
|
||||
}
|
||||
|
||||
if _, ok := subsubchart["nested"].(map[string]interface{})["boat"]; ok {
|
||||
t.Error("Expected sub-subchart nested boat key to be removed, still present")
|
||||
}
|
||||
|
||||
// CoalesceValues should not mutate the passed arguments
|
||||
|
|
|
|||
Loading…
Reference in a new issue