@@ -431,6 +431,32 @@ func TestOutputConfigMap(t *testing.T) {
431431 {"src01.3" , "prom.yaml" , "evaluation_interval" , "" },
432432 },
433433 },
434+ {
435+ name : "Test ConfigMap output with overlay+annotations" ,
436+ desc : "The number of the outputs in 'ConfigMap+overlay' should be the same as input sources" ,
437+ actual : mergerResource {
438+ Name : "test-output-configmap" ,
439+ Output : resourceOutput {
440+ Format : "configmap" ,
441+ Annotations : map [string ]string {
442+ "kustomize.config.k8s.io/needs-hash" : "true" ,
443+ },
444+ items : map [string ]string {
445+ "prom.yaml" : `
446+ global:
447+ scrape_interval: 15s
448+ evaluation_interval: 15s
449+ ` ,
450+ },
451+ },
452+ },
453+ expected : []testMergeCase {
454+ {"src01.1" , "prom.yaml" , "kind: ConfigMap" , "" },
455+ {"src01.2" , "prom.yaml" , "name: test-output-configmap" , "" },
456+ {"src01.3" , "prom.yaml" , "evaluation_interval" , "" },
457+ {"src01.4" , "prom.yaml" , "kustomize.config.k8s.io/needs-hash: \" true\" " , "" },
458+ },
459+ },
434460 }
435461
436462 for _ , tt := range tests {
@@ -478,6 +504,32 @@ func TestOutputSecret(t *testing.T) {
478504 {"src01.3" , "prom.yaml" , "CgkJCQkJCQlnbG9iYWw6CgkJCQkJCQkJc2NyYXBlX2ludGVydmFsOiAxNXMKCQkJCQkJCQ" , "" },
479505 },
480506 },
507+ {
508+ name : "Test Secret output with overlay+annotations" ,
509+ desc : "The number of the outputs in 'Secret+overlay' should be the same as input sources" ,
510+ actual : mergerResource {
511+ Name : "test-output-secret" ,
512+ Output : resourceOutput {
513+ Format : "secret" ,
514+ Annotations : map [string ]string {
515+ "kustomize.config.k8s.io/needs-hash" : "false" ,
516+ },
517+ items : map [string ]string {
518+ "prom.yaml" : `
519+ global:
520+ scrape_interval: 15s
521+ evaluation_interval: 15s
522+ ` ,
523+ },
524+ },
525+ },
526+ expected : []testMergeCase {
527+ {"src01.2" , "prom.yaml" , "kind: Secret" , "" },
528+ {"src01.2" , "prom.yaml" , "name: test-output-secret" , "" },
529+ {"src01.3" , "prom.yaml" , "CgkJCQkJCQlnbG9iYWw6CgkJCQkJCQkJc2NyYXBlX2ludGVydmFsOiAxNXMKCQkJCQkJCQ" , "" },
530+ {"src01.4" , "prom.yaml" , "kustomize.config.k8s.io/needs-hash: \" false\" " , "" },
531+ },
532+ },
481533 }
482534
483535 for _ , tt := range tests {
0 commit comments