@@ -355,13 +355,26 @@ var _ = Describe("Fleet apply driven", Ordered, func() {
355355 cli .AssetsPath + "driven/kustomize/overlays/dev/secret.yaml" ,
356356 cli .AssetsPath + "driven/kustomize/overlays/prod/kustomization.yaml" ,
357357 cli .AssetsPath + "driven/kustomize/overlays/prod/secret.yaml" ,
358- cli .AssetsPath + "driven/kustomize/dev.yaml" ,
359- cli .AssetsPath + "driven/kustomize/prod.yaml" ,
360358 }
361- Expect (kDevBundle .Spec .Resources ).To (HaveLen (8 ))
362- Expect (kProdBundle .Spec .Resources ).To (HaveLen (8 ))
363- for _ , r := range kResources {
359+
360+ // Note: the presence of a .fleetignore file, at the same level as both `dev.yaml` and
361+ // `prod.yaml`, excluding only `dev.yaml`, enables us to ensure that that file does not end up in
362+ // any bundle, being excluded from the dev bundle, but _also_ from the prod bundle.
363+ // We deliberately don't exclude both `dev.yaml` and `prod.yaml` from `.fleetignore`, simply to
364+ // validate that `prod.yaml` is excluded from the prod bundle without needing to be excluded from
365+ // `.fleetignore`.
366+
367+ kDevResources := append (slices .Clone (kResources ), cli .AssetsPath + "driven/kustomize/prod.yaml" )
368+ kProdResources := slices .Clone (kResources )
369+
370+ Expect (kDevBundle .Spec .Resources ).To (HaveLen (7 ))
371+ Expect (kProdBundle .Spec .Resources ).To (HaveLen (6 ))
372+
373+ for _ , r := range kDevResources {
364374 Expect (r ).To (bePresentInBundleResources (kDevBundle .Spec .Resources ))
375+ }
376+
377+ for _ , r := range kProdResources {
365378 Expect (r ).To (bePresentInBundleResources (kProdBundle .Spec .Resources ))
366379 }
367380
@@ -403,13 +416,26 @@ var _ = Describe("Fleet apply driven", Ordered, func() {
403416 cli .AssetsPath + "driven2/kustomize/overlays/dev/secret.yaml" ,
404417 cli .AssetsPath + "driven2/kustomize/overlays/prod/kustomization.yaml" ,
405418 cli .AssetsPath + "driven2/kustomize/overlays/prod/secret.yaml" ,
406- cli .AssetsPath + "driven2/kustomize/fleetDev.yaml" ,
407- cli .AssetsPath + "driven2/kustomize/fleetProd.yaml" ,
408419 }
409- Expect (kDevBundle .Spec .Resources ).To (HaveLen (8 ))
410- Expect (kProdBundle .Spec .Resources ).To (HaveLen (8 ))
411- for _ , r := range kResources {
420+
421+ // Note: the presence of a .fleetignore file, at the same level as both `fleetDev.yaml` and
422+ // `fleetProd.yaml`, excluding only `fleetProd.yaml`, enables us to ensure that that file does
423+ // not end up in any bundle, being excluded from the prod bundle, but _also_ from the dev bundle.
424+ // We deliberately don't exclude both `fleetDev.yaml` and `fleetProd.yaml` from `.fleetignore`,
425+ // simply to validate that `fleetDev.yaml` is excluded from the dev bundle without needing to be
426+ // excluded from `.fleetignore`.
427+
428+ kDevResources := slices .Clone (kResources )
429+ kProdResources := append (slices .Clone (kResources ), cli .AssetsPath + "driven2/kustomize/fleetDev.yaml" )
430+
431+ Expect (kDevBundle .Spec .Resources ).To (HaveLen (6 ))
432+ Expect (kProdBundle .Spec .Resources ).To (HaveLen (7 ))
433+
434+ for _ , r := range kDevResources {
412435 Expect (r ).To (bePresentInBundleResources (kDevBundle .Spec .Resources ))
436+ }
437+
438+ for _ , r := range kProdResources {
413439 Expect (r ).To (bePresentInBundleResources (kProdBundle .Spec .Resources ))
414440 }
415441
@@ -474,15 +500,15 @@ var _ = Describe("Fleet apply driven", Ordered, func() {
474500 // helm bundle
475501 helmBundle := bundles [0 ]
476502 Expect (helmBundle .Name ).To (Equal ("assets-driven-fleet-yaml-subfolder-helm-test-fl-b676f" ))
477- Expect (helmBundle .Spec .Resources ).To (HaveLen (4 ))
503+ Expect (helmBundle .Spec .Resources ).To (HaveLen (3 ))
478504 // as files were unpacked from the downloaded chart we can't just
479505 // list the files in the original folder and compare.
480506 // Files are only located in the bundle resources
481507 Expect ("Chart.yaml" ).To (bePresentOnlyInBundleResources (helmBundle .Spec .Resources ))
482508 Expect ("values.yaml" ).To (bePresentOnlyInBundleResources (helmBundle .Spec .Resources ))
483509 Expect ("templates/configmap.yaml" ).To (bePresentOnlyInBundleResources (helmBundle .Spec .Resources ))
484510 resPath := cli .AssetsPath + "driven_fleet_yaml_subfolder/helm/test/fleet.yaml"
485- Expect (resPath ).To (bePresentInBundleResources (helmBundle .Spec .Resources ))
511+ Expect (resPath ).NotTo (bePresentInBundleResources (helmBundle .Spec .Resources ))
486512 // check for helm options defined in the fleet.yaml file
487513 Expect (helmBundle .Spec .Helm ).ToNot (BeNil ())
488514 Expect (helmBundle .Spec .Helm .ReleaseName ).To (Equal ("config-chart" ))
0 commit comments