@@ -3,6 +3,7 @@ package e2e
3
3
import (
4
4
"context"
5
5
"encoding/json"
6
+
6
7
"github.com/blang/semver"
7
8
. "github.com/onsi/ginkgo"
8
9
. "github.com/onsi/gomega"
@@ -145,12 +146,13 @@ var _ = Describe("Package Manifest API lists available Operators from Catalog So
145
146
146
147
Context ("Given a CatalogSource created using gRPC catalog source type" , func () {
147
148
var (
148
- packageName string
149
- catalogSource * v1alpha1.CatalogSource
149
+ packageName , displayName string
150
+ catalogSource * v1alpha1.CatalogSource
150
151
)
151
152
BeforeEach (func () {
152
153
sourceName := genName ("catalog-" )
153
154
packageName = "etcd-test"
155
+ displayName = "etcd test catalog"
154
156
image := "quay.io/olmtest/catsrc-update-test:related"
155
157
156
158
catalogSource = & v1alpha1.CatalogSource {
@@ -164,8 +166,9 @@ var _ = Describe("Package Manifest API lists available Operators from Catalog So
164
166
Labels : map [string ]string {"olm.catalogSource" : sourceName },
165
167
},
166
168
Spec : v1alpha1.CatalogSourceSpec {
167
- SourceType : v1alpha1 .SourceTypeGrpc ,
168
- Image : image ,
169
+ SourceType : v1alpha1 .SourceTypeGrpc ,
170
+ Image : image ,
171
+ DisplayName : displayName ,
169
172
},
170
173
}
171
174
@@ -195,6 +198,36 @@ var _ = Describe("Package Manifest API lists available Operators from Catalog So
195
198
"quay.io/coreos/etcd-operator@sha256:c0301e4686c3ed4206e370b42de5a3bd2229b9fb4906cf85f3f30650424abec2" ,
196
199
}), "Expected images to exist in the related images list\n " )
197
200
})
201
+
202
+ When ("the display name for catalog source is updated" , func () {
203
+
204
+ BeforeEach (func () {
205
+
206
+ pm , err := fetchPackageManifest (pmc , testNamespace , packageName , packageManifestHasStatus )
207
+ Expect (err ).NotTo (HaveOccurred (), "error getting package manifest" )
208
+ Expect (pm ).ShouldNot (BeNil ())
209
+ Expect (pm .GetName ()).Should (Equal (packageName ))
210
+ Expect (pm .Status .CatalogSourceDisplayName ).Should (Equal (displayName ))
211
+
212
+ catalogSource , err = crc .OperatorsV1alpha1 ().CatalogSources (testNamespace ).Get (context .TODO (), catalogSource .GetName (), metav1.GetOptions {})
213
+ Expect (err ).NotTo (HaveOccurred (), "error getting catalogSource" )
214
+
215
+ displayName = "updated Name"
216
+ catalogSource .Spec .DisplayName = displayName
217
+ catalogSource , err = crc .OperatorsV1alpha1 ().CatalogSources (testNamespace ).Update (context .TODO (), catalogSource , metav1.UpdateOptions {})
218
+ Expect (err ).NotTo (HaveOccurred (), "error updating catalogSource" )
219
+ Expect (catalogSource .Spec .DisplayName ).Should (Equal (displayName ))
220
+ })
221
+ It ("should successfully update the CatalogSource field" , func () {
222
+
223
+ Eventually (func () string {
224
+ pm , err := fetchPackageManifest (pmc , testNamespace , packageName ,
225
+ packageManifestHasStatus )
226
+ Expect (err ).NotTo (HaveOccurred (), "error getting package manifest after updating catsrc" )
227
+ return pm .Status .CatalogSourceDisplayName
228
+ }).Should (Equal (displayName ))
229
+ })
230
+ })
198
231
})
199
232
})
200
233
@@ -203,7 +236,6 @@ type packageManifestCheckFunc func(*packagev1.PackageManifest) bool
203
236
func packageManifestHasStatus (pm * packagev1.PackageManifest ) bool {
204
237
// as long as it has a package name we consider the status non-empty
205
238
return pm != nil && pm .Status .PackageName != ""
206
-
207
239
}
208
240
209
241
func fetchPackageManifest (pmc pmversioned.Interface , namespace , name string , check packageManifestCheckFunc ) (* packagev1.PackageManifest , error ) {
0 commit comments