Skip to content

Commit

Permalink
🌱 update skopeo openshift test (#3298)
Browse files Browse the repository at this point in the history
* update skopeo openshift test

Signed-off-by: Per Goncalves da Silva <pegoncal@redhat.com>

* patch subscription e2e flake

Signed-off-by: Per Goncalves da Silva <pegoncal@redhat.com>

---------

Signed-off-by: Per Goncalves da Silva <pegoncal@redhat.com>
Co-authored-by: Per Goncalves da Silva <pegoncal@redhat.com>
  • Loading branch information
perdasilva and Per Goncalves da Silva committed May 31, 2024
1 parent 7b8a0cc commit 61669af
Showing 1 changed file with 10 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2597,19 +2597,24 @@ var _ = Describe("Subscription", func() {
err = magicCatalog.UpdateCatalog(context.Background(), provider)
Expect(err).To(BeNil())

By("waiting for the subscription to have v0.3.0 installed")
By("waiting for the subscription to switch to v0.3.0")
sub, err = fetchSubscription(crc, generatedNamespace.GetName(), subName, subscriptionHasCurrentCSV("example-operator.v0.3.0"))
Expect(err).Should(BeNil())

By("waiting for the subscription to have v0.3.0 installed with a Package deprecated condition")
By("waiting for the subscription to have be at latest known")
sub, err = fetchSubscription(crc, generatedNamespace.GetName(), subName, subscriptionStateAtLatestChecker())
Expect(err).Should(BeNil())

By("waiting for the subscription to have v0.3.0 installed without a bundle deprecated condition")
sub, err = fetchSubscription(crc, generatedNamespace.GetName(), subName,
subscriptionHasCondition(
operatorsv1alpha1.SubscriptionPackageDeprecated,
corev1.ConditionTrue,
operatorsv1alpha1.SubscriptionInstallPlanPending,
corev1.ConditionUnknown,
"",
"",
"olm.package/test-package: test-package has been deprecated. Please switch to another-package.",
),
)
Expect(err).Should(BeNil())

By("checking for the deprecated conditions")
By(`Operator is deprecated at only Package and Channel levels`)
Expand Down Expand Up @@ -3627,12 +3632,6 @@ func updateInternalCatalog(t GinkgoTInterface, c operatorclient.ClientInterface,
require.NoError(t, err)
}

func updateCatSrcPriority(crClient versioned.Interface, namespace string, catsrc *operatorsv1alpha1.CatalogSource, priority int) {
catsrc.Spec.Priority = priority
_, err := crClient.OperatorsV1alpha1().CatalogSources(namespace).Update(context.Background(), catsrc, metav1.UpdateOptions{})
Expect(err).Should(BeNil())
}

func subscriptionCurrentCSVGetter(crclient versioned.Interface, namespace, subName string) func() string {
return func() string {
subscription, err := crclient.OperatorsV1alpha1().Subscriptions(namespace).Get(context.Background(), subName, metav1.GetOptions{})
Expand All @@ -3642,15 +3641,3 @@ func subscriptionCurrentCSVGetter(crclient versioned.Interface, namespace, subNa
return subscription.Status.CurrentCSV
}
}

func operatorGroupServiceAccountNameSetter(crclient versioned.Interface, namespace, name, saName string) func() error {
return func() error {
toUpdate, err := crclient.OperatorsV1().OperatorGroups(namespace).Get(context.Background(), name, metav1.GetOptions{})
if err != nil {
return err
}
toUpdate.Spec.ServiceAccountName = saName
_, err = crclient.OperatorsV1().OperatorGroups(namespace).Update(context.Background(), toUpdate, metav1.UpdateOptions{})
return err
}
}

0 comments on commit 61669af

Please sign in to comment.