@@ -10,6 +10,8 @@ import (
1010 . "github.com/onsi/gomega"
1111 operatorsv1alpha1 "github.com/operator-framework/api/pkg/operators/v1alpha1"
1212 "github.com/operator-framework/operator-lifecycle-manager/pkg/controller/registry"
13+ "github.com/operator-framework/operator-lifecycle-manager/test/e2e/ctx"
14+
1315 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions"
1416 apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
1517 apiextensionsv1beta1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1"
@@ -299,13 +301,12 @@ var _ = Describe("CRD Versions", func() {
299301
300302 // old CRD has been installed onto the cluster - now upgrade the subscription to point to the channel with the new CRD
301303 // 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" )
309310
310311 subscriptionAtLatestWithDifferentInstallPlan := func (v * operatorsv1alpha1.Subscription ) bool {
311312 return subscriptionStateAtLatestChecker (v ) && v .Status .InstallPlanRef != nil && v .Status .InstallPlanRef .Name != fetchedInstallPlan .Name
0 commit comments