@@ -55,3 +55,52 @@ services:
5555 },
5656 })
5757}
58+
59+ func TestParseYAMLFilesMergeOverride (t * testing.T ) {
60+ model , err := loadYamlModel (context .TODO (), types.ConfigDetails {
61+ ConfigFiles : []types.ConfigFile {
62+ {Filename : "override.yaml" ,
63+ Content : []byte (`
64+ services:
65+ base:
66+ configs:
67+ - source: credentials
68+ target: /credentials/file1
69+ x: &x
70+ extends:
71+ base
72+ configs: !override
73+ - source: credentials
74+ target: /literally-anywhere-else
75+
76+ y:
77+ <<: *x
78+
79+ configs:
80+ credentials:
81+ content: |
82+ dummy value
83+ ` )},
84+ }}, & Options {}, & cycleTracker {}, nil )
85+ assert .NilError (t , err )
86+ assert .DeepEqual (t , model , map [string ]interface {}{
87+ "configs" : map [string ]interface {}{"credentials" : map [string ]interface {}{"content" : string ("dummy value\n " )}},
88+ "services" : map [string ]interface {}{
89+ "base" : map [string ]interface {}{
90+ "configs" : []interface {}{
91+ map [string ]interface {}{"source" : string ("credentials" ), "target" : string ("/credentials/file1" )},
92+ },
93+ },
94+ "x" : map [string ]interface {}{
95+ "configs" : []interface {}{
96+ map [string ]interface {}{"source" : string ("credentials" ), "target" : string ("/literally-anywhere-else" )},
97+ },
98+ },
99+ "y" : map [string ]interface {}{
100+ "configs" : []interface {}{
101+ map [string ]interface {}{"source" : string ("credentials" ), "target" : string ("/literally-anywhere-else" )},
102+ },
103+ },
104+ },
105+ })
106+ }
0 commit comments