@@ -338,13 +338,26 @@ var _ = Describe("Fleet apply driven", Ordered, func() {
338338 cli .AssetsPath + "driven/kustomize/overlays/dev/secret.yaml" ,
339339 cli .AssetsPath + "driven/kustomize/overlays/prod/kustomization.yaml" ,
340340 cli .AssetsPath + "driven/kustomize/overlays/prod/secret.yaml" ,
341- cli .AssetsPath + "driven/kustomize/dev.yaml" ,
342- cli .AssetsPath + "driven/kustomize/prod.yaml" ,
343341 }
344- Expect (kDevBundle .Spec .Resources ).To (HaveLen (8 ))
345- Expect (kProdBundle .Spec .Resources ).To (HaveLen (8 ))
346- for _ , r := range kResources {
342+
343+ // Note: the presence of a .fleetignore file, at the same level as both `dev.yaml` and
344+ // `prod.yaml`, excluding only `dev.yaml`, enables us to ensure that that file does not end up in
345+ // any bundle, being excluded from the dev bundle, but _also_ from the prod bundle.
346+ // We deliberately don't exclude both `dev.yaml` and `prod.yaml` from `.fleetignore`, simply to
347+ // validate that `prod.yaml` is excluded from the prod bundle without needing to be excluded from
348+ // `.fleetignore`.
349+
350+ kDevResources := append (slices .Clone (kResources ), cli .AssetsPath + "driven/kustomize/prod.yaml" )
351+ kProdResources := slices .Clone (kResources )
352+
353+ Expect (kDevBundle .Spec .Resources ).To (HaveLen (7 ))
354+ Expect (kProdBundle .Spec .Resources ).To (HaveLen (6 ))
355+
356+ for _ , r := range kDevResources {
347357 Expect (r ).To (bePresentInBundleResources (kDevBundle .Spec .Resources ))
358+ }
359+
360+ for _ , r := range kProdResources {
348361 Expect (r ).To (bePresentInBundleResources (kProdBundle .Spec .Resources ))
349362 }
350363
@@ -386,13 +399,26 @@ var _ = Describe("Fleet apply driven", Ordered, func() {
386399 cli .AssetsPath + "driven2/kustomize/overlays/dev/secret.yaml" ,
387400 cli .AssetsPath + "driven2/kustomize/overlays/prod/kustomization.yaml" ,
388401 cli .AssetsPath + "driven2/kustomize/overlays/prod/secret.yaml" ,
389- cli .AssetsPath + "driven2/kustomize/fleetDev.yaml" ,
390- cli .AssetsPath + "driven2/kustomize/fleetProd.yaml" ,
391402 }
392- Expect (kDevBundle .Spec .Resources ).To (HaveLen (8 ))
393- Expect (kProdBundle .Spec .Resources ).To (HaveLen (8 ))
394- for _ , r := range kResources {
403+
404+ // Note: the presence of a .fleetignore file, at the same level as both `fleetDev.yaml` and
405+ // `fleetProd.yaml`, excluding only `fleetProd.yaml`, enables us to ensure that that file does
406+ // not end up in any bundle, being excluded from the prod bundle, but _also_ from the dev bundle.
407+ // We deliberately don't exclude both `fleetDev.yaml` and `fleetProd.yaml` from `.fleetignore`,
408+ // simply to validate that `fleetDev.yaml` is excluded from the dev bundle without needing to be
409+ // excluded from `.fleetignore`.
410+
411+ kDevResources := slices .Clone (kResources )
412+ kProdResources := append (slices .Clone (kResources ), cli .AssetsPath + "driven2/kustomize/fleetDev.yaml" )
413+
414+ Expect (kDevBundle .Spec .Resources ).To (HaveLen (6 ))
415+ Expect (kProdBundle .Spec .Resources ).To (HaveLen (7 ))
416+
417+ for _ , r := range kDevResources {
395418 Expect (r ).To (bePresentInBundleResources (kDevBundle .Spec .Resources ))
419+ }
420+
421+ for _ , r := range kProdResources {
396422 Expect (r ).To (bePresentInBundleResources (kProdBundle .Spec .Resources ))
397423 }
398424
@@ -457,15 +483,15 @@ var _ = Describe("Fleet apply driven", Ordered, func() {
457483 // helm bundle
458484 helmBundle := bundles [0 ]
459485 Expect (helmBundle .Name ).To (Equal ("assets-driven-fleet-yaml-subfolder-helm-test-fl-b676f" ))
460- Expect (helmBundle .Spec .Resources ).To (HaveLen (4 ))
486+ Expect (helmBundle .Spec .Resources ).To (HaveLen (3 ))
461487 // as files were unpacked from the downloaded chart we can't just
462488 // list the files in the original folder and compare.
463489 // Files are only located in the bundle resources
464490 Expect ("Chart.yaml" ).To (bePresentOnlyInBundleResources (helmBundle .Spec .Resources ))
465491 Expect ("values.yaml" ).To (bePresentOnlyInBundleResources (helmBundle .Spec .Resources ))
466492 Expect ("templates/configmap.yaml" ).To (bePresentOnlyInBundleResources (helmBundle .Spec .Resources ))
467493 resPath := cli .AssetsPath + "driven_fleet_yaml_subfolder/helm/test/fleet.yaml"
468- Expect (resPath ).To (bePresentInBundleResources (helmBundle .Spec .Resources ))
494+ Expect (resPath ).NotTo (bePresentInBundleResources (helmBundle .Spec .Resources ))
469495 // check for helm options defined in the fleet.yaml file
470496 Expect (helmBundle .Spec .Helm ).ToNot (BeNil ())
471497 Expect (helmBundle .Spec .Helm .ReleaseName ).To (Equal ("config-chart" ))
0 commit comments