@@ -687,6 +687,85 @@ func TestCatalogdControllerReconcile(t *testing.T) {
687687 },
688688 },
689689 },
690+ {
691+ name : "after catalog availability set to enable, finalizer should be added" ,
692+ puller : & imageutil.MockPuller {
693+ ImageFS : & fstest.MapFS {},
694+ },
695+ store : & MockStore {},
696+ catalog : & ocv1.ClusterCatalog {
697+ ObjectMeta : metav1.ObjectMeta {
698+ Name : "catalog" ,
699+ Finalizers : []string {},
700+ },
701+ Spec : ocv1.ClusterCatalogSpec {
702+ Source : ocv1.CatalogSource {
703+ Type : ocv1 .SourceTypeImage ,
704+ Image : & ocv1.ImageSource {
705+ Ref : "my.org/someimage:latest" ,
706+ },
707+ },
708+ AvailabilityMode : ocv1 .AvailabilityModeAvailable ,
709+ },
710+ Status : ocv1.ClusterCatalogStatus {
711+ URLs : & ocv1.ClusterCatalogURLs {Base : "URL" },
712+ ResolvedSource : & ocv1.ResolvedCatalogSource {
713+ Type : ocv1 .SourceTypeImage ,
714+ Image : & ocv1.ResolvedImageSource {
715+ Ref : "" ,
716+ },
717+ },
718+ Conditions : []metav1.Condition {
719+ {
720+ Type : ocv1 .TypeServing ,
721+ Status : metav1 .ConditionFalse ,
722+ Reason : ocv1 .ReasonUnavailable ,
723+ },
724+ {
725+ Type : ocv1 .TypeProgressing ,
726+ Status : metav1 .ConditionFalse ,
727+ Reason : ocv1 .ReasonUserSpecifiedUnavailable ,
728+ },
729+ },
730+ },
731+ },
732+ expectedCatalog : & ocv1.ClusterCatalog {
733+ ObjectMeta : metav1.ObjectMeta {
734+ Name : "catalog" ,
735+ Finalizers : []string {fbcDeletionFinalizer },
736+ },
737+ Spec : ocv1.ClusterCatalogSpec {
738+ Source : ocv1.CatalogSource {
739+ Type : ocv1 .SourceTypeImage ,
740+ Image : & ocv1.ImageSource {
741+ Ref : "my.org/someimage:latest" ,
742+ },
743+ },
744+ AvailabilityMode : ocv1 .AvailabilityModeAvailable ,
745+ },
746+ Status : ocv1.ClusterCatalogStatus {
747+ URLs : & ocv1.ClusterCatalogURLs {Base : "URL" },
748+ ResolvedSource : & ocv1.ResolvedCatalogSource {
749+ Type : ocv1 .SourceTypeImage ,
750+ Image : & ocv1.ResolvedImageSource {
751+ Ref : "" ,
752+ },
753+ },
754+ Conditions : []metav1.Condition {
755+ {
756+ Type : ocv1 .TypeServing ,
757+ Status : metav1 .ConditionFalse ,
758+ Reason : ocv1 .ReasonUnavailable ,
759+ },
760+ {
761+ Type : ocv1 .TypeProgressing ,
762+ Status : metav1 .ConditionFalse ,
763+ Reason : ocv1 .ReasonUserSpecifiedUnavailable ,
764+ },
765+ },
766+ },
767+ },
768+ },
690769 } {
691770 t .Run (tt .name , func (t * testing.T ) {
692771 reconciler := & ClusterCatalogReconciler {
0 commit comments