@@ -141,7 +141,7 @@ var _ = Context("creating clusterResourceOverride (selecting all clusters) to ov
141141 }, eventuallyDuration , eventuallyInterval ).Should (Succeed (), "Failed to update cro as expected" , crpName )
142142 })
143143
144- It ("should update CRP status on demand as expected " , func () {
144+ It ("should refresh the CRP status even as there is no change on the resources " , func () {
145145 wantCRONames := []string {fmt .Sprintf (placementv1alpha1 .OverrideSnapshotNameFmt , croName , 1 )}
146146 crpStatusUpdatedActual := crpStatusWithOverrideUpdatedActual (workResourceIdentifiers (), allMemberClusterNames , "0" , wantCRONames , nil )
147147 Eventually (crpStatusUpdatedActual , eventuallyDuration , eventuallyInterval ).Should (Succeed (), "Failed to update CRP %s status as expected" , crpName )
@@ -155,6 +155,44 @@ var _ = Context("creating clusterResourceOverride (selecting all clusters) to ov
155155 checkIfOverrideAnnotationsOnAllMemberClusters (true , want )
156156 })
157157
158+ It ("update cro attached to this CRP only and no updates on the namespace" , func () {
159+ Eventually (func () error {
160+ cro := & placementv1alpha1.ClusterResourceOverride {}
161+ if err := hubClient .Get (ctx , types.NamespacedName {Name : croName }, cro ); err != nil {
162+ return err
163+ }
164+ cro .Spec .Policy .OverrideRules = append (cro .Spec .Policy .OverrideRules , placementv1alpha1.OverrideRule {
165+ ClusterSelector : & placementv1beta1.ClusterSelector {
166+ ClusterSelectorTerms : []placementv1beta1.ClusterSelectorTerm {
167+ {
168+ LabelSelector : & metav1.LabelSelector {
169+ MatchLabels : map [string ]string {
170+ "invalid-key" : "invalid-value" ,
171+ },
172+ },
173+ },
174+ },
175+ },
176+ OverrideType : placementv1alpha1 .DeleteOverrideType ,
177+ })
178+ return hubClient .Update (ctx , cro )
179+ }, eventuallyDuration , eventuallyInterval ).Should (Succeed (), "Failed to update cro as expected" , crpName )
180+ })
181+
182+ It ("should update CRP status on demand as expected" , func () {
183+ wantCRONames := []string {fmt .Sprintf (placementv1alpha1 .OverrideSnapshotNameFmt , croName , 2 )}
184+ crpStatusUpdatedActual := crpStatusWithOverrideUpdatedActual (workResourceIdentifiers (), allMemberClusterNames , "0" , wantCRONames , nil )
185+ Eventually (crpStatusUpdatedActual , eventuallyDuration , eventuallyInterval ).Should (Succeed (), "Failed to update CRP %s status as expected" , crpName )
186+ })
187+
188+ // This check will ignore the annotation of resources.
189+ It ("should place the selected resources on member clusters" , checkIfPlacedWorkResourcesOnAllMemberClusters )
190+
191+ It ("should have new override annotation value on the placed resources" , func () {
192+ want := map [string ]string {croTestAnnotationKey : croTestAnnotationValue1 }
193+ checkIfOverrideAnnotationsOnAllMemberClusters (true , want )
194+ })
195+
158196 It ("delete the cro attached to this CRP" , func () {
159197 cleanupClusterResourceOverride (croName )
160198 })
0 commit comments