@ -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
b ar : null
b oat : 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 , "b ar ": true } ,
"nested" : map [ string ] interface { } { "foo" : false , "b oat ": 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