@@ -130,7 +130,7 @@ var _ = Context("creating clusterResourceOverride (selecting all clusters) to ov
130130 }, eventuallyDuration , eventuallyInterval ).Should (Succeed (), "Failed to update cro as expected" , crpName )
131131 })
132132
133- It ("should update CRP status on demand as expected " , func () {
133+ It ("should refresh the CRP status even as there is no change on the resources " , func () {
134134 wantCRONames := []string {fmt .Sprintf (placementv1alpha1 .OverrideSnapshotNameFmt , croName , 1 )}
135135 crpStatusUpdatedActual := crpStatusWithOverrideUpdatedActual (workResourceIdentifiers (), allMemberClusterNames , "0" , wantCRONames , nil )
136136 Eventually (crpStatusUpdatedActual , eventuallyDuration , eventuallyInterval ).Should (Succeed (), "Failed to update CRP %s status as expected" , crpName )
@@ -144,6 +144,44 @@ var _ = Context("creating clusterResourceOverride (selecting all clusters) to ov
144144 checkIfOverrideAnnotationsOnAllMemberClusters (true , want )
145145 })
146146
147+ It ("update cro attached to this CRP only and no updates on the namespace" , func () {
148+ Eventually (func () error {
149+ cro := & placementv1alpha1.ClusterResourceOverride {}
150+ if err := hubClient .Get (ctx , types.NamespacedName {Name : croName }, cro ); err != nil {
151+ return err
152+ }
153+ cro .Spec .Policy .OverrideRules = append (cro .Spec .Policy .OverrideRules , placementv1alpha1.OverrideRule {
154+ ClusterSelector : & placementv1beta1.ClusterSelector {
155+ ClusterSelectorTerms : []placementv1beta1.ClusterSelectorTerm {
156+ {
157+ LabelSelector : & metav1.LabelSelector {
158+ MatchLabels : map [string ]string {
159+ "invalid-key" : "invalid-value" ,
160+ },
161+ },
162+ },
163+ },
164+ },
165+ OverrideType : placementv1alpha1 .DeleteOverrideType ,
166+ })
167+ return hubClient .Update (ctx , cro )
168+ }, eventuallyDuration , eventuallyInterval ).Should (Succeed (), "Failed to update cro as expected" , crpName )
169+ })
170+
171+ It ("should update CRP status on demand as expected" , func () {
172+ wantCRONames := []string {fmt .Sprintf (placementv1alpha1 .OverrideSnapshotNameFmt , croName , 2 )}
173+ crpStatusUpdatedActual := crpStatusWithOverrideUpdatedActual (workResourceIdentifiers (), allMemberClusterNames , "0" , wantCRONames , nil )
174+ Eventually (crpStatusUpdatedActual , eventuallyDuration , eventuallyInterval ).Should (Succeed (), "Failed to update CRP %s status as expected" , crpName )
175+ })
176+
177+ // This check will ignore the annotation of resources.
178+ It ("should place the selected resources on member clusters" , checkIfPlacedWorkResourcesOnAllMemberClusters )
179+
180+ It ("should have new override annotation value on the placed resources" , func () {
181+ want := map [string ]string {croTestAnnotationKey : croTestAnnotationValue1 }
182+ checkIfOverrideAnnotationsOnAllMemberClusters (true , want )
183+ })
184+
147185 It ("delete the cro attached to this CRP" , func () {
148186 cleanupClusterResourceOverride (croName )
149187 })
0 commit comments