@@ -167,56 +167,115 @@ func TestDependenciesForKustomization(t *testing.T) {
167
167
description : "resources" ,
168
168
yaml : `resources: [pod1.yaml, path/pod2.yaml]` ,
169
169
expected : []string {"kustomization.yaml" , "pod1.yaml" , "path/pod2.yaml" },
170
+ createFiles : map [string ]string {
171
+ "pod1.yaml" : "" ,
172
+ "path/pod2.yaml" : "" ,
173
+ },
170
174
},
171
175
{
172
176
description : "paches" ,
173
177
yaml : `patches: [patch1.yaml, path/patch2.yaml]` ,
174
178
expected : []string {"kustomization.yaml" , "patch1.yaml" , "path/patch2.yaml" },
179
+ createFiles : map [string ]string {
180
+ "patch1.yaml" : "" ,
181
+ "path/patch2.yaml" : "" ,
182
+ },
175
183
},
176
184
{
177
185
description : "patchesStrategicMerge" ,
178
186
yaml : `patchesStrategicMerge: [patch1.yaml, path/patch2.yaml]` ,
179
187
expected : []string {"kustomization.yaml" , "patch1.yaml" , "path/patch2.yaml" },
188
+ createFiles : map [string ]string {
189
+ "patch1.yaml" : "" ,
190
+ "path/patch2.yaml" : "" ,
191
+ },
180
192
},
181
193
{
182
194
description : "crds" ,
183
195
yaml : `patches: [crd1.yaml, path/crd2.yaml]` ,
184
196
expected : []string {"kustomization.yaml" , "crd1.yaml" , "path/crd2.yaml" },
197
+ createFiles : map [string ]string {
198
+ "crd1.yaml" : "" ,
199
+ "path/crd2.yaml" : "" ,
200
+ },
185
201
},
186
202
{
187
203
description : "patches json 6902" ,
188
204
yaml : `patchesJson6902:
189
205
- path: patch1.json
190
206
- path: path/patch2.json` ,
191
207
expected : []string {"kustomization.yaml" , "patch1.json" , "path/patch2.json" },
208
+ createFiles : map [string ]string {
209
+ "patch1.json" : "" ,
210
+ "path/patch2.json" : "" ,
211
+ },
192
212
},
193
213
{
194
214
description : "configMapGenerator" ,
195
215
yaml : `configMapGenerator:
196
216
- files: [app1.properties]
197
217
- files: [app2.properties, app3.properties]` ,
198
218
expected : []string {"kustomization.yaml" , "app1.properties" , "app2.properties" , "app3.properties" },
219
+ createFiles : map [string ]string {
220
+ "app1.properties" : "" ,
221
+ "app2.properties" : "" ,
222
+ "app3.properties" : "" ,
223
+ },
199
224
},
200
225
{
201
226
description : "secretGenerator" ,
202
227
yaml : `secretGenerator:
203
228
- files: [secret1.file]
204
229
- files: [secret2.file, secret3.file]` ,
205
230
expected : []string {"kustomization.yaml" , "secret1.file" , "secret2.file" , "secret3.file" },
231
+ createFiles : map [string ]string {
232
+ "secrite1.file" : "" ,
233
+ "secrite2.file" : "" ,
234
+ "secrite3.file" : "" ,
235
+ },
206
236
},
207
237
{
208
238
description : "base exists locally" ,
209
239
yaml : `bases: [base]` ,
210
- expected : []string {"base/ kustomization.yaml" , "base/app .yaml" , "kustomization .yaml" },
240
+ expected : []string {"kustomization.yaml" , "base/kustomization .yaml" , "base/app .yaml" },
211
241
createFiles : map [string ]string {
212
242
"base/kustomization.yaml" : `resources: [app.yaml]` ,
243
+ "base/app.yaml" : "" ,
213
244
},
214
245
},
215
246
{
216
247
description : "missing base locally" ,
217
248
yaml : `bases: [missing-or-remote-base]` ,
218
249
expected : []string {"kustomization.yaml" },
219
250
},
251
+ {
252
+ description : "local kustomization resource" ,
253
+ yaml : `resources: [app.yaml, base]` ,
254
+ expected : []string {"kustomization.yaml" , "app.yaml" , "base/kustomization.yaml" , "base/app.yaml" },
255
+ createFiles : map [string ]string {
256
+ "app.yaml" : "" ,
257
+ "base/kustomization.yaml" : `resources: [app.yaml]` ,
258
+ "base/app.yaml" : "" ,
259
+ },
260
+ },
261
+ {
262
+ description : "missing local kustomization resource" ,
263
+ yaml : `resources: [app.yaml, missing-or-remote-base]` ,
264
+ expected : []string {"kustomization.yaml" , "app.yaml" },
265
+ createFiles : map [string ]string {
266
+ "app.yaml" : "" ,
267
+ },
268
+ },
269
+ {
270
+ description : "mixed resource types" ,
271
+ yaml : `resources: [app.yaml, missing-or-remote-base, base]` ,
272
+ expected : []string {"kustomization.yaml" , "app.yaml" , "base/kustomization.yaml" , "base/app.yaml" },
273
+ createFiles : map [string ]string {
274
+ "app.yaml" : "" ,
275
+ "base/kustomization.yaml" : `resources: [app.yaml]` ,
276
+ "base/app.yaml" : "" ,
277
+ },
278
+ },
220
279
}
221
280
for _ , test := range tests {
222
281
testutil .Run (t , test .description , func (t * testutil.T ) {
0 commit comments