Skip to content

Commit 7043a08

Browse files
e2e: prevent leftovers after golden-images test (#4027)
To prevent having leftover DataSources after the golden-images functional test is running, set the `RetentionPolicy` of all the customized DICT to "None". From CDI API: ``` DataImportCronRetainNone specifies that the created DataVolumes and DataSources are deleted when their DataImportCron is deleted. ``` Signed-off-by: Nahshon Unna Tsameret <nunnatsa@redhat.com> Co-authored-by: Nahshon Unna Tsameret <nunnatsa@redhat.com>
1 parent e2e1e37 commit 7043a08

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

tests/func-tests/golden_image_test.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -459,6 +459,7 @@ var _ = Describe("golden image test", Label("data-import-cron"), Serial, Ordered
459459

460460
customDictArchs := append(archs, "someOtherArch1", "someOtherArch2")
461461
hcCustomDict.Annotations[goldenimages.MultiArchDICTAnnotation] = strings.Join(customDictArchs, ",")
462+
hcCustomDict.Spec.RetentionPolicy = ptr.To(cdiv1beta1.DataImportCronRetainNone)
462463

463464
hc.Spec.DataImportCronTemplates = []hcov1beta1.DataImportCronTemplate{hcCustomDict}
464465

@@ -521,6 +522,7 @@ var _ = Describe("golden image test", Label("data-import-cron"), Serial, Ordered
521522
customDictArchs := append(archs, "someOtherArch1", "someOtherArch2")
522523
testAnnotation := strings.Join(customDictArchs, ",")
523524
hcCustomDict.Annotations[goldenimages.MultiArchDICTAnnotation] = testAnnotation
525+
hcCustomDict.Spec.RetentionPolicy = ptr.To(cdiv1beta1.DataImportCronRetainNone)
524526
expectedArches = getExpectedArchs(testAnnotation, archs)
525527

526528
hc.Spec.DataImportCronTemplates = []hcov1beta1.DataImportCronTemplate{hcCustomDict}
@@ -593,6 +595,7 @@ var _ = Describe("golden image test", Label("data-import-cron"), Serial, Ordered
593595
hcCustomDict.Name = "custom-dict"
594596
hcCustomDict.Spec.ManagedDataSource = "custom-source"
595597
delete(hcCustomDict.Annotations, goldenimages.MultiArchDICTAnnotation)
598+
hcCustomDict.Spec.RetentionPolicy = ptr.To(cdiv1beta1.DataImportCronRetainNone)
596599

597600
hc.Spec.DataImportCronTemplates = []hcov1beta1.DataImportCronTemplate{hcCustomDict}
598601

@@ -658,6 +661,7 @@ var _ = Describe("golden image test", Label("data-import-cron"), Serial, Ordered
658661
}
659662

660663
hcCustomDict.Annotations[goldenimages.MultiArchDICTAnnotation] = "someOtherArch1,someOtherArch2"
664+
hcCustomDict.Spec.RetentionPolicy = ptr.To(cdiv1beta1.DataImportCronRetainNone)
661665

662666
hc.Spec.DataImportCronTemplates = []hcov1beta1.DataImportCronTemplate{hcCustomDict}
663667

@@ -728,6 +732,7 @@ var _ = Describe("golden image test", Label("data-import-cron"), Serial, Ordered
728732
hcCustomDict.Spec.Template.Spec.Source.Registry = nextDICT.Spec.Template.Spec.Source.Registry.DeepCopy()
729733

730734
hcCustomDict.Annotations[goldenimages.MultiArchDICTAnnotation] = "someOtherArch1,someOtherArch2"
735+
hcCustomDict.Spec.RetentionPolicy = ptr.To(cdiv1beta1.DataImportCronRetainNone)
731736

732737
hc.Spec.DataImportCronTemplates = []hcov1beta1.DataImportCronTemplate{hcCustomDict}
733738

@@ -796,6 +801,7 @@ var _ = Describe("golden image test", Label("data-import-cron"), Serial, Ordered
796801

797802
originalSupportedArchitectures = hc.Status.DataImportCronTemplates[0].Status.OriginalSupportedArchitectures
798803
hcCustomDict.Annotations[goldenimages.MultiArchDICTAnnotation] = "someOtherArch1,someOtherArch2"
804+
hcCustomDict.Spec.RetentionPolicy = ptr.To(cdiv1beta1.DataImportCronRetainNone)
799805

800806
hc.Spec.DataImportCronTemplates = []hcov1beta1.DataImportCronTemplate{hcCustomDict}
801807

0 commit comments

Comments
 (0)