Skip to content

Fix failing webhook e2e test #2419

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions test/e2e/bundle_e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,10 @@ var _ = Describe("Installing bundles with new object types", func() {
return err
}).Should(Succeed())

// Wait for the CatalogSource to be ready
_, err = fetchCatalogSourceOnStatus(operatorClient, source.GetName(), source.GetNamespace(), catalogSourceRegistryPodSynced)
Expect(err).ToNot(HaveOccurred(), "catalog source did not become ready")

// Create a Subscription for package
_ = createSubscriptionForCatalog(operatorClient, source.GetNamespace(), subName, source.GetName(), packageName, channelName, "", v1alpha1.ApprovalAutomatic)

Expand Down
13 changes: 12 additions & 1 deletion test/e2e/catalog_e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -482,6 +482,10 @@ var _ = Describe("Catalog represents a store of bundles which OLM can use to ins
Expect(err).ShouldNot(HaveOccurred())
}()

// Wait for the CatalogSource to be ready
_, err = fetchCatalogSourceOnStatus(crc, addressSource.GetName(), addressSource.GetNamespace(), catalogSourceRegistryPodSynced)
Expect(err).ToNot(HaveOccurred(), "catalog source did not become ready")

// Delete CatalogSources
err = crc.OperatorsV1alpha1().CatalogSources(testNamespace).Delete(context.TODO(), mainSourceName, metav1.DeleteOptions{})
Expect(err).ShouldNot(HaveOccurred())
Expand Down Expand Up @@ -892,6 +896,10 @@ var _ = Describe("Catalog represents a store of bundles which OLM can use to ins
Expect(err).ShouldNot(HaveOccurred())
}()

// Wait for the CatalogSource to be ready
_, err = fetchCatalogSourceOnStatus(crc, source.GetName(), source.GetNamespace(), catalogSourceRegistryPodSynced)
Expect(err).ToNot(HaveOccurred(), "catalog source did not become ready")

// Create a Subscription for busybox
subscriptionName := genName("sub-")
cleanupSubscription := createSubscriptionForCatalog(crc, source.GetNamespace(), subscriptionName, source.GetName(), packageName, channelName, "", v1alpha1.ApprovalAutomatic)
Expand Down Expand Up @@ -935,6 +943,10 @@ var _ = Describe("Catalog represents a store of bundles which OLM can use to ins
return false, nil
}).Should(BeTrue())

// Wait for the CatalogSource to be ready
_, err = fetchCatalogSourceOnStatus(crc, source.GetName(), source.GetNamespace(), catalogSourceRegistryPodSynced)
Expect(err).ToNot(HaveOccurred(), "catalog source did not become ready")

// Wait for the busybox v2 Subscription to succeed
subChecker := func(sub *v1alpha1.Subscription) bool {
return sub.Status.InstalledCSV == "busybox.v2.0.0"
Expand Down Expand Up @@ -1065,7 +1077,6 @@ var _ = Describe("Catalog represents a store of bundles which OLM can use to ins
Expect(err).ShouldNot(HaveOccurred(), "error getting catalog source")

// create an annotation using the kube templates

source.SetAnnotations(map[string]string{catalogsource.CatalogImageTemplateAnnotation: fmt.Sprintf("quay.io/olmtest/catsrc-update-test:%s.%s.%s", catalogsource.TemplKubeMajorV, catalogsource.TemplKubeMinorV, catalogsource.TemplKubePatchV)})

// Update the catalog image
Expand Down
12 changes: 12 additions & 0 deletions test/e2e/gc_e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,10 @@ var _ = Describe("Garbage collection for dependent resources", func() {
return nil
}).Should(Succeed(), "could not create catalog source")

// Wait for the CatalogSource to be ready
_, err := fetchCatalogSourceOnStatus(operatorClient, source.GetName(), source.GetNamespace(), catalogSourceRegistryPodSynced)
Expect(err).ToNot(HaveOccurred(), "catalog source did not become ready")

// Create a Subscription for package
_ = createSubscriptionForCatalog(operatorClient, source.GetNamespace(), subName, source.GetName(), packageName, channelName, "", v1alpha1.ApprovalAutomatic)

Expand Down Expand Up @@ -468,6 +472,10 @@ var _ = Describe("Garbage collection for dependent resources", func() {
return err
}).Should(Succeed(), "could not create catalog source")

// Wait for the CatalogSource to be ready
_, err = fetchCatalogSourceOnStatus(operatorClient, source.GetName(), source.GetNamespace(), catalogSourceRegistryPodSynced)
Expect(err).ToNot(HaveOccurred(), "catalog source did not become ready")

// Create a Subscription for package
_ = createSubscriptionForCatalog(operatorClient, source.GetNamespace(), subName, source.GetName(), packageName, channelName, "", v1alpha1.ApprovalAutomatic)

Expand Down Expand Up @@ -577,6 +585,10 @@ var _ = Describe("Garbage collection for dependent resources", func() {
return err
}).Should(Succeed())

// Wait for the CatalogSource to be ready
_, err = fetchCatalogSourceOnStatus(operatorClient, source.GetName(), source.GetNamespace(), catalogSourceRegistryPodSynced)
Expect(err).ToNot(HaveOccurred(), "catalog source did not become ready")

// Create a Subscription for package
_ = createSubscriptionForCatalog(operatorClient, source.GetNamespace(), subName, source.GetName(), packageName, channelName, "", v1alpha1.ApprovalAutomatic)

Expand Down
4 changes: 4 additions & 0 deletions test/e2e/operator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,10 @@ var _ = Describe("Operator API", func() {
return client.Create(clientCtx, cs)
}).Should(Succeed())

// Wait for the CatalogSource to be ready
_, err := fetchCatalogSourceOnStatus(newCRClient(), cs.GetName(), cs.GetNamespace(), catalogSourceRegistryPodSynced)
Expect(err).ToNot(HaveOccurred())

sub = &operatorsv1alpha1.Subscription{
Spec: &operatorsv1alpha1.SubscriptionSpec{
CatalogSource: cs.GetName(),
Expand Down
4 changes: 4 additions & 0 deletions test/e2e/packagemanifest_e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,10 @@ var _ = Describe("Package Manifest API lists available Operators from Catalog So
var err error
catalogSource, err = crc.OperatorsV1alpha1().CatalogSources(catalogSource.GetNamespace()).Create(context.TODO(), catalogSource, metav1.CreateOptions{})
Expect(err).NotTo(HaveOccurred())

// Wait for the CatalogSource to be ready
_, err = fetchCatalogSourceOnStatus(crc, catalogSource.GetName(), catalogSource.GetNamespace(), catalogSourceRegistryPodSynced)
Expect(err).ToNot(HaveOccurred(), "catalog source did not become ready")
})

AfterEach(func() {
Expand Down
4 changes: 4 additions & 0 deletions test/e2e/subscription_e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -847,6 +847,10 @@ var _ = Describe("Subscription", func() {
Expect(err).ToNot(HaveOccurred())
}()

// Wait for the CatalogSource status to be updated to reflect its invalid spec
_, err = fetchCatalogSourceOnStatus(crc, cs.GetName(), cs.GetNamespace(), catalogSourceInvalidSpec)
Expect(err).ToNot(HaveOccurred(), "catalog source did not become ready")

subName := genName("sub-")
cleanup := createSubscriptionForCatalog(
crc,
Expand Down
4 changes: 4 additions & 0 deletions test/e2e/util_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,10 @@ func catalogSourceRegistryPodSynced(catalog *v1alpha1.CatalogSource) bool {
return false
}

func catalogSourceInvalidSpec(catalog *v1alpha1.CatalogSource) bool {
return catalog.Status.Reason == v1alpha1.CatalogSourceSpecInvalidError
}

func fetchCatalogSourceOnStatus(crc versioned.Interface, name, namespace string, check catalogSourceCheckFunc) (*v1alpha1.CatalogSource, error) {
var fetched *v1alpha1.CatalogSource
var err error
Expand Down
4 changes: 4 additions & 0 deletions test/e2e/webhook_e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -673,6 +673,10 @@ var _ = Describe("CSVs with a Webhook", func() {
require.NoError(GinkgoT(), crc.OperatorsV1alpha1().CatalogSources(source.GetNamespace()).Delete(context.TODO(), source.GetName(), metav1.DeleteOptions{}))
}

// Wait for the CatalogSource to be ready
_, err = fetchCatalogSourceOnStatus(crc, source.GetName(), source.GetNamespace(), catalogSourceRegistryPodSynced)
require.NoError(GinkgoT(), err)

// Create a Subscription for the webhook-operator
subscriptionName := genName("sub-")
cleanupSubscription := createSubscriptionForCatalog(crc, testNamespace, subscriptionName, source.GetName(), packageName, channelName, "", operatorsv1alpha1.ApprovalAutomatic)
Expand Down