@@ -86,7 +86,8 @@ func Test_SimpleRevisionGenerator_GenerateRevisionFromHelmRelease(t *testing.T)
8686 "olm.operatorframework.io/package-name" : "my-package" ,
8787 },
8888 Labels : map [string ]string {
89- "olm.operatorframework.io/owner" : "test-123" ,
89+ "olm.operatorframework.io/owner-kind" : "ClusterExtension" ,
90+ "olm.operatorframework.io/owner-name" : "test-123" ,
9091 },
9192 },
9293 Spec : ocv1.ClusterExtensionRevisionSpec {
@@ -178,9 +179,10 @@ func Test_SimpleRevisionGenerator_GenerateRevision(t *testing.T) {
178179 rev , err := b .GenerateRevision (t .Context (), fstest.MapFS {}, ext , map [string ]string {}, map [string ]string {})
179180 require .NoError (t , err )
180181
181- t .Log ("by checking the olm.operatorframework.io/ owner label is set to the name of the ClusterExtension " )
182+ t .Log ("by checking the owner labels are set correctly (owner-kind and owner-name) " )
182183 require .Equal (t , map [string ]string {
183- controllers .ClusterExtensionRevisionOwnerLabel : "test-extension" ,
184+ labels .OwnerKindKey : ocv1 .ClusterExtensionKind ,
185+ labels .OwnerNameKey : "test-extension" ,
184186 }, rev .Labels )
185187 t .Log ("by checking the revision number is 0" )
186188 require .Equal (t , int64 (0 ), rev .Spec .Revision )
@@ -288,13 +290,13 @@ func Test_SimpleRevisionGenerator_AppliesObjectLabelsAndRevisionAnnotations(t *t
288290 ManifestProvider : r ,
289291 }
290292
291- revAnnotations := map [string ]string {
293+ revisionAnnotations := map [string ]string {
292294 "other" : "value" ,
293295 }
294296
295297 rev , err := b .GenerateRevision (t .Context (), fstest.MapFS {}, & ocv1.ClusterExtension {}, map [string ]string {
296298 "some" : "value" ,
297- }, revAnnotations )
299+ }, revisionAnnotations )
298300 require .NoError (t , err )
299301 t .Log ("by checking the rendered objects contain the given object labels" )
300302 for _ , phase := range rev .Spec .Phases {
@@ -305,8 +307,8 @@ func Test_SimpleRevisionGenerator_AppliesObjectLabelsAndRevisionAnnotations(t *t
305307 }, revObj .Object .GetLabels ())
306308 }
307309 }
308- t .Log ("by checking the generated revision contain the given annotations" )
309- require .Equal (t , revAnnotations , rev .Annotations )
310+ t .Log ("by checking the generated revision contains the given annotations" )
311+ require .Equal (t , revisionAnnotations , rev .Annotations )
310312}
311313
312314func Test_SimpleRevisionGenerator_Failure (t * testing.T ) {
@@ -344,7 +346,8 @@ func TestBoxcutter_Apply(t *testing.T) {
344346 Name : "test-ext-1" ,
345347 UID : "rev-uid-1" ,
346348 Labels : map [string ]string {
347- controllers .ClusterExtensionRevisionOwnerLabel : ext .Name ,
349+ labels .OwnerKindKey : ocv1 .ClusterExtensionKind ,
350+ labels .OwnerNameKey : ext .Name ,
348351 },
349352 },
350353 Spec : ocv1.ClusterExtensionRevisionSpec {
@@ -400,10 +403,11 @@ func TestBoxcutter_Apply(t *testing.T) {
400403 makeRevisionFunc : func (ctx context.Context , bundleFS fs.FS , ext * ocv1.ClusterExtension , objectLabels , revisionAnnotations map [string ]string ) (* ocv1.ClusterExtensionRevision , error ) {
401404 return & ocv1.ClusterExtensionRevision {
402405 ObjectMeta : metav1.ObjectMeta {
403- Annotations : revisionAnnotations ,
404406 Labels : map [string ]string {
405- controllers .ClusterExtensionRevisionOwnerLabel : ext .Name ,
407+ labels .OwnerKindKey : ocv1 .ClusterExtensionKind ,
408+ labels .OwnerNameKey : ext .Name ,
406409 },
410+ Annotations : revisionAnnotations ,
407411 },
408412 Spec : ocv1.ClusterExtensionRevisionSpec {
409413 Phases : []ocv1.ClusterExtensionRevisionPhase {
@@ -787,14 +791,15 @@ func TestBoxcutter_Apply(t *testing.T) {
787791 },
788792 },
789793 {
790- name : "annotation-only update (same phases, different annotations )" ,
794+ name : "annotation update (same phases, different metadata )" ,
791795 mockBuilder : & mockBundleRevisionBuilder {
792796 makeRevisionFunc : func (ctx context.Context , bundleFS fs.FS , ext * ocv1.ClusterExtension , objectLabels , revisionAnnotations map [string ]string ) (* ocv1.ClusterExtensionRevision , error ) {
793797 return & ocv1.ClusterExtensionRevision {
794798 ObjectMeta : metav1.ObjectMeta {
795799 Annotations : revisionAnnotations ,
796800 Labels : map [string ]string {
797- controllers .ClusterExtensionRevisionOwnerLabel : ext .Name ,
801+ labels .OwnerKindKey : ocv1 .ClusterExtensionKind ,
802+ labels .OwnerNameKey : ext .Name ,
798803 },
799804 },
800805 Spec : ocv1.ClusterExtensionRevisionSpec {
@@ -830,7 +835,8 @@ func TestBoxcutter_Apply(t *testing.T) {
830835 labels .PackageNameKey : "test-package" ,
831836 },
832837 Labels : map [string ]string {
833- controllers .ClusterExtensionRevisionOwnerLabel : ext .Name ,
838+ labels .OwnerKindKey : ocv1 .ClusterExtensionKind ,
839+ labels .OwnerNameKey : ext .Name ,
834840 },
835841 },
836842 Spec : ocv1.ClusterExtensionRevisionSpec {
@@ -870,7 +876,8 @@ func TestBoxcutter_Apply(t *testing.T) {
870876 assert .Equal (t , "1.0.1" , rev .Annotations [labels .BundleVersionKey ])
871877 assert .Equal (t , "test-package" , rev .Annotations [labels .PackageNameKey ])
872878 // Verify owner label is still present
873- assert .Equal (t , ext .Name , rev .Labels [controllers .ClusterExtensionRevisionOwnerLabel ])
879+ assert .Equal (t , ext .Name , rev .Labels [labels .OwnerNameKey ])
880+ assert .Equal (t , ocv1 .ClusterExtensionKind , rev .Labels [labels .OwnerKindKey ])
874881 },
875882 },
876883 }
@@ -896,8 +903,8 @@ func TestBoxcutter_Apply(t *testing.T) {
896903
897904 // Execute
898905 revisionAnnotations := map [string ]string {}
899- if tc .name == "annotation-only update (same phases, different annotations )" {
900- // For annotation-only update test, pass NEW annotations
906+ if tc .name == "annotation update (same phases, different metadata )" {
907+ // For annotation update test, pass NEW metadata in annotations
901908 revisionAnnotations = map [string ]string {
902909 labels .BundleVersionKey : "1.0.1" ,
903910 labels .PackageNameKey : "test-package" ,
@@ -1045,7 +1052,7 @@ func TestBoxcutterStorageMigrator(t *testing.T) {
10451052
10461053// mockBundleRevisionBuilder is a mock implementation of the ClusterExtensionRevisionGenerator for testing.
10471054type mockBundleRevisionBuilder struct {
1048- makeRevisionFunc func (ctx context.Context , bundleFS fs.FS , ext * ocv1.ClusterExtension , objectLabels , revisionAnnotation map [string ]string ) (* ocv1.ClusterExtensionRevision , error )
1055+ makeRevisionFunc func (ctx context.Context , bundleFS fs.FS , ext * ocv1.ClusterExtension , objectLabels , revisionAnnotations map [string ]string ) (* ocv1.ClusterExtensionRevision , error )
10491056}
10501057
10511058func (m * mockBundleRevisionBuilder ) GenerateRevision (ctx context.Context , bundleFS fs.FS , ext * ocv1.ClusterExtension , objectLabels , revisionAnnotations map [string ]string ) (* ocv1.ClusterExtensionRevision , error ) {
@@ -1061,7 +1068,8 @@ func (m *mockBundleRevisionBuilder) GenerateRevisionFromHelmRelease(
10611068 ObjectMeta : metav1.ObjectMeta {
10621069 Name : "test-revision" ,
10631070 Labels : map [string ]string {
1064- controllers .ClusterExtensionRevisionOwnerLabel : ext .Name ,
1071+ labels .OwnerKindKey : ocv1 .ClusterExtensionKind ,
1072+ labels .OwnerNameKey : ext .Name ,
10651073 },
10661074 },
10671075 Spec : ocv1.ClusterExtensionRevisionSpec {},
0 commit comments