@@ -10,6 +10,8 @@ import (
10
10
. "github.com/onsi/gomega"
11
11
operatorsv1alpha1 "github.com/operator-framework/api/pkg/operators/v1alpha1"
12
12
"github.com/operator-framework/operator-lifecycle-manager/pkg/controller/registry"
13
+ "github.com/operator-framework/operator-lifecycle-manager/test/e2e/ctx"
14
+
13
15
"k8s.io/apiextensions-apiserver/pkg/apis/apiextensions"
14
16
apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
15
17
apiextensionsv1beta1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1"
@@ -299,13 +301,12 @@ var _ = Describe("CRD Versions", func() {
299
301
300
302
// old CRD has been installed onto the cluster - now upgrade the subscription to point to the channel with the new CRD
301
303
// installing the new CSV should fail with a warning about data loss, since a storage version is missing in the new CRD
302
- sub , err := crc .OperatorsV1alpha1 ().Subscriptions (testNamespace ).Get (context .TODO (), subscription .GetName (), metav1.GetOptions {})
303
- Expect (err ).ToNot (HaveOccurred (), "could not get subscription" )
304
-
305
- // update channel on sub
306
- sub .Spec .Channel = alphaChannel
307
- _ , err = crc .OperatorsV1alpha1 ().Subscriptions (testNamespace ).Update (context .TODO (), sub , metav1.UpdateOptions {})
308
- Expect (err ).ToNot (HaveOccurred (), "could not update subscription" )
304
+ // use server-side apply to apply the update to the subscription point to the alpha channel
305
+ Eventually (Apply (subscription , func (s * operatorsv1alpha1.Subscription ) error {
306
+ s .Spec .Channel = alphaChannel
307
+ return nil
308
+ })).Should (Succeed ())
309
+ ctx .Ctx ().Logf ("updated subscription to point to alpha channel" )
309
310
310
311
subscriptionAtLatestWithDifferentInstallPlan := func (v * operatorsv1alpha1.Subscription ) bool {
311
312
return subscriptionStateAtLatestChecker (v ) && v .Status .InstallPlanRef != nil && v .Status .InstallPlanRef .Name != fetchedInstallPlan .Name
0 commit comments