Skip to content

Commit c165ece

Browse files
author
Mikalai Radchuk
committed
WIP: catalog e2e
Signed-off-by: Mikalai Radchuk <[email protected]>
1 parent db8082f commit c165ece

File tree

2 files changed

+16
-25
lines changed

2 files changed

+16
-25
lines changed

pkg/controller/operators/catalog/operator.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1072,6 +1072,7 @@ func (o *Operator) syncResolvingNamespace(obj interface{}) error {
10721072
var unpacked bool
10731073
unpacked, steps, bundleLookups, err = o.unpackBundles(namespace, steps, bundleLookups, unpackTimeout)
10741074
if err != nil {
1075+
// TODO: handle fatal errors (e.g. olmerrors.IsFatal(err)) and set a condition on subs
10751076
return fmt.Errorf("bundle unpacking failed with an error: %v", err)
10761077
}
10771078

test/e2e/catalog_e2e_test.go

Lines changed: 15 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1010,7 +1010,7 @@ var _ = Describe("Starting CatalogSource e2e tests", func() {
10101010

10111011
catSrcImage := "quay.io/olmtest/busybox-dependencies-index"
10121012

1013-
// Create gRPC CatalogSource
1013+
By("creating gRPC CatalogSource")
10141014
source := &v1alpha1.CatalogSource{
10151015
TypeMeta: metav1.TypeMeta{
10161016
Kind: v1alpha1.CatalogSourceKind,
@@ -1028,30 +1028,29 @@ var _ = Describe("Starting CatalogSource e2e tests", func() {
10281028
},
10291029
},
10301030
}
1031-
10321031
source, err := crc.OperatorsV1alpha1().CatalogSources(source.GetNamespace()).Create(context.Background(), source, metav1.CreateOptions{})
10331032
Expect(err).ShouldNot(HaveOccurred())
10341033
defer func() {
10351034
err := crc.OperatorsV1alpha1().CatalogSources(source.GetNamespace()).Delete(context.Background(), source.GetName(), metav1.DeleteOptions{})
10361035
Expect(err).ShouldNot(HaveOccurred())
10371036
}()
10381037

1039-
// Wait for the CatalogSource to be ready
1038+
By("waiting for the CatalogSource to be ready")
10401039
_, err = fetchCatalogSourceOnStatus(crc, source.GetName(), source.GetNamespace(), catalogSourceRegistryPodSynced)
10411040
Expect(err).ToNot(HaveOccurred(), "catalog source did not become ready")
10421041

1043-
// Create a Subscription for busybox
1042+
By("creating a Subscription for busybox")
10441043
subscriptionName := genName("sub-")
10451044
cleanupSubscription := createSubscriptionForCatalog(crc, source.GetNamespace(), subscriptionName, source.GetName(), packageName, channelName, "", v1alpha1.ApprovalAutomatic)
10461045
defer cleanupSubscription()
10471046

1048-
// Wait for the Subscription to succeed
1047+
By("waiting for the Subscription to succeed")
10491048
subscription, err := fetchSubscription(crc, ns.GetName(), subscriptionName, subscriptionStateAtLatestChecker)
10501049
Expect(err).ShouldNot(HaveOccurred())
10511050
Expect(subscription).ShouldNot(BeNil())
10521051
Expect(subscription.Status.InstalledCSV).To(Equal("busybox.v1.0.0"))
10531052

1054-
// Confirm that a subscription was created for busybox-dependency
1053+
By("confirming that a subscription was created for busybox-dependency")
10551054
subscriptionList, err := crc.OperatorsV1alpha1().Subscriptions(source.GetNamespace()).List(context.Background(), metav1.ListOptions{})
10561055
Expect(err).ShouldNot(HaveOccurred())
10571056
dependencySubscriptionName := ""
@@ -1062,13 +1061,13 @@ var _ = Describe("Starting CatalogSource e2e tests", func() {
10621061
}
10631062
Expect(dependencySubscriptionName).ToNot(BeEmpty())
10641063

1065-
// Wait for the Subscription to succeed
1064+
By("waiting for the Subscription to succeed")
10661065
subscription, err = fetchSubscription(crc, ns.GetName(), dependencySubscriptionName, subscriptionStateAtLatestChecker)
10671066
Expect(err).ShouldNot(HaveOccurred())
10681067
Expect(subscription).ShouldNot(BeNil())
10691068
Expect(subscription.Status.InstalledCSV).To(Equal("busybox-dependency.v1.0.0"))
10701069

1071-
// Update the catalog image
1070+
By("updating the catalog image")
10721071
Eventually(func() error {
10731072
existingSource, err := crc.OperatorsV1alpha1().CatalogSources(source.GetNamespace()).Get(context.Background(), sourceName, metav1.GetOptions{})
10741073
if err != nil {
@@ -1080,32 +1079,32 @@ var _ = Describe("Starting CatalogSource e2e tests", func() {
10801079
return err
10811080
}).Should(Succeed())
10821081

1083-
// Wait for the CatalogSource to be ready
1082+
By("waiting for the CatalogSource to be ready")
10841083
_, err = fetchCatalogSourceOnStatus(crc, source.GetName(), source.GetNamespace(), catalogSourceRegistryPodSynced)
10851084
Expect(err).ToNot(HaveOccurred(), "catalog source did not become ready")
10861085

1087-
// Wait for the busybox v2 Subscription to succeed
1086+
By("waiting for the busybox v2 Subscription to succeed")
10881087
subChecker := func(sub *v1alpha1.Subscription) bool {
10891088
return sub.Status.InstalledCSV == "busybox.v2.0.0"
10901089
}
10911090
subscription, err = fetchSubscription(crc, ns.GetName(), subscriptionName, subChecker)
10921091
Expect(err).ShouldNot(HaveOccurred())
10931092
Expect(subscription).ShouldNot(BeNil())
10941093

1095-
// Wait for busybox v2 csv to succeed and check the replaces field
1094+
By("waiting for busybox v2 csv to succeed and check the replaces field")
10961095
csv, err := fetchCSV(crc, subscription.Status.CurrentCSV, subscription.GetNamespace(), csvSucceededChecker)
10971096
Expect(err).ShouldNot(HaveOccurred())
10981097
Expect(csv.Spec.Replaces).To(Equal("busybox.v1.0.0"))
10991098

1100-
// Wait for the busybox-dependency v2 Subscription to succeed
1099+
By("waiting for the busybox-dependency v2 Subscription to succeed")
11011100
subChecker = func(sub *v1alpha1.Subscription) bool {
11021101
return sub.Status.InstalledCSV == "busybox-dependency.v2.0.0"
11031102
}
11041103
subscription, err = fetchSubscription(crc, ns.GetName(), dependencySubscriptionName, subChecker)
11051104
Expect(err).ShouldNot(HaveOccurred())
11061105
Expect(subscription).ShouldNot(BeNil())
11071106

1108-
// Wait for busybox-dependency v2 csv to succeed and check the replaces field
1107+
By("waiting for busybox-dependency v2 csv to succeed and check the replaces field")
11091108
csv, err = fetchCSV(crc, subscription.Status.CurrentCSV, subscription.GetNamespace(), csvSucceededChecker)
11101109
Expect(err).ShouldNot(HaveOccurred())
11111110
Expect(csv.Spec.Replaces).To(Equal("busybox-dependency.v1.0.0"))
@@ -1403,18 +1402,9 @@ var _ = Describe("Starting CatalogSource e2e tests", func() {
14031402
Expect(c.Create(context.Background(), subscription)).To(BeNil())
14041403
})
14051404

1406-
It("fails with a ResolutionFailed error condition, and a message that highlights the missing field in the CSV", func() {
1407-
1408-
subscription, err := fetchSubscription(crc, subscription.GetNamespace(), subscription.GetName(), subscriptionHasInstallPlanChecker)
1409-
Expect(err).Should(BeNil())
1410-
installPlanName := subscription.Status.Install.Name
1411-
1412-
// ensure we wait for the installPlan to fail before moving forward then fetch the subscription again
1413-
_, err = fetchInstallPlan(GinkgoT(), crc, installPlanName, subscription.GetNamespace(), buildInstallPlanPhaseCheckFunc(operatorsv1alpha1.InstallPlanPhaseFailed))
1414-
Expect(err).To(BeNil())
1415-
subscription, err = fetchSubscription(crc, subscription.GetNamespace(), subscription.GetName(), subscriptionHasInstallPlanChecker)
1416-
Expect(err).To(BeNil())
1417-
1405+
// TODO: Sort this out. Probably need to change the implementation to expose this on sub now.
1406+
FIt("fails with a ResolutionFailed error condition, and a message that highlights the missing field in the CSV", func() {
1407+
// TODO: use Eventually once handling added into the catalog operator & condition exists
14181408
// expect the message that API missing
14191409
failingCondition := subscription.Status.GetCondition(operatorsv1alpha1.SubscriptionInstallPlanFailed)
14201410
Expect(failingCondition.Message).To(ContainSubstring("missing APIVersion"))

0 commit comments

Comments
 (0)