1- // Copyright 2025 The kpt and Nephio Authors
1+ // Copyright 2025-2026 The kpt and Nephio Authors
22//
33// Licensed under the Apache License, Version 2.0 (the "License");
44// you may not use this file except in compliance with the License.
@@ -36,10 +36,10 @@ var (
3636)
3737
3838type MetadataTestCase struct {
39- Name string
40- RepoName string
41- Setup func (* PorchSuite , string ) * porchapi.PackageRevision
42- Validate func (* PorchSuite , * porchapi.PackageRevision )
39+ Name string
40+ RepoName string
41+ Setup func (* PorchSuite , string ) * porchapi.PackageRevision
42+ Validate func (* PorchSuite , * porchapi.PackageRevision )
4343}
4444
4545func (t * PorchSuite ) TestPackageRevisionMetadata () {
@@ -80,27 +80,27 @@ func (t *PorchSuite) TestPackageRevisionMetadata() {
8080 pr .Spec .Lifecycle = porchapi .PackageRevisionLifecycleProposed
8181 t .UpdateF (pr )
8282 t .GetF (client.ObjectKey {Namespace : pr .Namespace , Name : pr .Name }, pr )
83-
83+
8484 t .ValidateLabelsAndAnnos (pr .Name , map [string ]string {"kpt.dev/label" : "foo" }, map [string ]string {"kpt.dev/anno" : "foo" , "kpt.dev/other-anno" : "bar" })
8585 pr .Spec .Lifecycle = porchapi .PackageRevisionLifecyclePublished
8686 t .UpdateApprovalF (pr , metav1.UpdateOptions {})
87-
87+
8888 t .ValidateLabelsAndAnnos (pr .Name , map [string ]string {"kpt.dev/label" : "foo" , porchapi .LatestPackageRevisionKey : porchapi .LatestPackageRevisionValue }, map [string ]string {"kpt.dev/anno" : "foo" , "kpt.dev/other-anno" : "bar" })
8989 t .GetF (client.ObjectKey {Namespace : pr .Namespace , Name : pr .Name }, pr )
9090 delete (pr .Labels , "kpt.dev/label" )
9191 pr .Labels ["kpt.dev/other-label" ] = "bar"
9292 delete (pr .Annotations , "kpt.dev/other-anno" )
9393 pr .Spec .Revision = 1
9494 t .UpdateF (pr )
95-
95+
9696 t .ValidateLabelsAndAnnos (pr .Name , map [string ]string {"kpt.dev/other-label" : "bar" , porchapi .LatestPackageRevisionKey : porchapi .LatestPackageRevisionValue }, map [string ]string {"kpt.dev/anno" : "foo" })
9797 clonedPr := t .CreatePackageSkeleton (pr .Spec .RepositoryName , "cloned-package" , defaultWorkspace )
9898 clonedPr .Spec .Tasks = []porchapi.Task {{
9999 Type : porchapi .TaskTypeClone ,
100100 Clone : & porchapi.PackageCloneTaskSpec {Upstream : porchapi.UpstreamPackage {UpstreamRef : & porchapi.PackageRevisionRef {Name : pr .Name }}},
101101 }}
102102 t .CreateF (clonedPr )
103-
103+
104104 t .ValidateLabelsAndAnnos (clonedPr .Name , map [string ]string {}, map [string ]string {})
105105 },
106106 },
@@ -152,10 +152,10 @@ func (t *PorchSuite) TestPackageRevisionGarbageCollection() {
152152 t .RegisterGitRepositoryF (t .GetPorchTestRepoURL (), repoName , "" , suiteutils .GiteaUser , suiteutils .GiteaPassword )
153153 pr := t .CreatePackageDraftF (repoName , "empty-package" , "test-workspace" )
154154 cm := & corev1.ConfigMap {
155- TypeMeta : metav1.TypeMeta {Kind : configMapGVK .Kind , APIVersion : configMapGVK .GroupVersion ().String ()},
155+ TypeMeta : metav1.TypeMeta {Kind : configMapGVK .Kind , APIVersion : configMapGVK .GroupVersion ().String ()},
156156 ObjectMeta : metav1.ObjectMeta {Name : "cm-cascades" , Namespace : t .Namespace , OwnerReferences : []metav1.OwnerReference {
157157 {APIVersion : porchapi .SchemeGroupVersion .String (), Kind : suiteutils .PackageRevisionGVK .Kind , Name : pr .Name , UID : pr .UID }}},
158- Data : map [string ]string {"foo" : "bar" },
158+ Data : map [string ]string {"foo" : "bar" },
159159 }
160160 t .CreateF (cm )
161161 t .DeleteF (pr )
@@ -409,4 +409,4 @@ func (t *PorchSuite) TestPackageRevisionFinalizers() {
409409 readPR .Finalizers = []string {}
410410 t .UpdateF (readPR )
411411 t .WaitUntilObjectDeleted (suiteutils .PackageRevisionGVK , types.NamespacedName {Name : readPR .Name , Namespace : readPR .Namespace }, 10 * time .Second )
412- }
412+ }
0 commit comments