1
1
package convert
2
2
3
3
import (
4
+ "fmt"
4
5
"testing"
5
6
6
7
. "github.com/onsi/ginkgo/v2"
@@ -16,6 +17,7 @@ import (
16
17
"sigs.k8s.io/controller-runtime/pkg/client"
17
18
18
19
"github.com/operator-framework/api/pkg/operators/v1alpha1"
20
+ "github.com/operator-framework/operator-registry/alpha/property"
19
21
)
20
22
21
23
func TestRegistryV1Converter (t * testing.T ) {
@@ -173,6 +175,9 @@ var _ = Describe("RegistryV1 Suite", func() {
173
175
csv = v1alpha1.ClusterServiceVersion {
174
176
ObjectMeta : metav1.ObjectMeta {
175
177
Name : "testCSV" ,
178
+ Annotations : map [string ]string {
179
+ "olm.properties" : fmt .Sprintf ("[{\" type\" : %s, \" value\" : \" %s\" }]" , property .TypeConstraint , "value" ),
180
+ },
176
181
},
177
182
Spec : v1alpha1.ClusterServiceVersionSpec {
178
183
InstallModes : []v1alpha1.InstallMode {{Type : v1alpha1 .InstallModeTypeMultiNamespace , Supported : true }},
@@ -380,6 +385,22 @@ var _ = Describe("RegistryV1 Suite", func() {
380
385
Expect (err ).To (HaveOccurred ())
381
386
Expect (plainBundle ).To (BeNil ())
382
387
})
388
+
389
+ It ("should propagate csv annotations to chart metadata annotation" , func () {
390
+ By ("creating a registry v1 bundle" )
391
+ watchNamespaces = []string {"testWatchNs1" , "testWatchNs2" }
392
+ unstructuredSvc := convertToUnstructured (svc )
393
+ registryv1Bundle = RegistryV1 {
394
+ PackageName : "testPkg" ,
395
+ CSV : csv ,
396
+ Others : []unstructured.Unstructured {unstructuredSvc },
397
+ }
398
+
399
+ By ("converting to helm" )
400
+ chrt , err := toChart (registryv1Bundle , installNamespace , watchNamespaces )
401
+ Expect (err ).NotTo (HaveOccurred ())
402
+ Expect (chrt .Metadata .Annotations ["olm.properties" ]).NotTo (BeNil ())
403
+ })
383
404
})
384
405
385
406
Context ("Should enforce limitations" , func () {
0 commit comments