timflannagan / rukpak

Rukpak runs in a Kubernetes cluster and defines an API for installing cloud native bundle content
Apache License 2.0
0 stars 0 forks source link

when a BundleInstance is missing a bundle.Spec required field #46

Open github-actions[bot] opened 2 years ago

github-actions[bot] commented 2 years ago

https://github.com/timflannagan/rukpak/blob/78956e26d6757f6b8308172a7eecfaa47c29e8b3/test/e2e/plain_provisioner_test.go#L1014


        })
    })

    When("a BundleInstance targets a Bundle that contains CRDs and instances of those CRDs", func() {
        var (
            bi  *rukpakv1alpha1.BundleInstance
            ctx context.Context
        )
        BeforeEach(func() {
            ctx = context.Background()

            By("creating the testing BI resource")
            bi = &rukpakv1alpha1.BundleInstance{
                ObjectMeta: metav1.ObjectMeta{
                    GenerateName: "e2e-bi-crds-and-crs",
                },
                Spec: rukpakv1alpha1.BundleInstanceSpec{
                    ProvisionerClassName: plainProvisionerID,
                    Template: &rukpakv1alpha1.BundleTemplate{
                        ObjectMeta: metav1.ObjectMeta{
                            Name: "e2e-bundle-crds-and-crs",
                        },
                        Spec: rukpakv1alpha1.BundleSpec{
                            ProvisionerClassName: plainProvisionerID,
                            Source: rukpakv1alpha1.BundleSource{
                                Type: rukpakv1alpha1.SourceTypeImage,
                                Image: &rukpakv1alpha1.ImageSource{
                                    Ref: "testdata/bundles/plain-v0:invalid-crds-and-crs",
                                },
                            },
                        },
                    },
                },
            }
            err := c.Create(ctx, bi)
            Expect(err).To(BeNil())
        })
        AfterEach(func() {
            By("deleting the testing BI resource")
            Expect(c.Delete(ctx, bi)).To(BeNil())
        })
        It("eventually reports a failed installation state due to missing APIs on the cluster", func() {
            Eventually(func() (*metav1.Condition, error) {
                if err := c.Get(ctx, client.ObjectKeyFromObject(bi), bi); err != nil {
                    return nil, err
                }
                return meta.FindStatusCondition(bi.Status.Conditions, rukpakv1alpha1.TypeInstalled), nil
            }).Should(And(
                Not(BeNil()),
                WithTransform(func(c *metav1.Condition) string { return c.Type }, Equal(rukpakv1alpha1.TypeInstalled)),
                WithTransform(func(c *metav1.Condition) metav1.ConditionStatus { return c.Status }, Equal(metav1.ConditionFalse)),
                WithTransform(func(c *metav1.Condition) string { return c.Reason }, Equal(rukpakv1alpha1.ReasonInstallFailed)),
                WithTransform(func(c *metav1.Condition) string { return c.Message }, ContainSubstring(`no matches for kind "CatalogSource" in version "operators.coreos.com/v1alpha1"`)),
            ))
        })
    })

    // TODO: when a BundleInstance is missing a bundle.Spec required field
    PWhen("a BundleInstance is pivoted between Bundles that share a CRD", func() {
        var (
            ctx            context.Context
            originalBundle *rukpakv1alpha1.Bundle
            pivotedBundle  *rukpakv1alpha1.Bundle
            bi             *rukpakv1alpha1.BundleInstance
        )
        BeforeEach(func() {
            ctx = context.Background()

            By("creating the original testing Bundle resource")
            originalBundle = &rukpakv1alpha1.Bundle{
                ObjectMeta: metav1.ObjectMeta{
                    GenerateName: "e2e-original-bundle-crd-pivoting",
                },
                Spec: rukpakv1alpha1.BundleSpec{
                    ProvisionerClassName: plainProvisionerID,
github-actions[bot] commented 2 years ago

This issue has become stale because it has been open 60 days with no activity. The maintainers of this repo will remove this label during issue triage or it will be removed automatically after an update. Adding the lifecycle/frozen label will cause this issue to ignore lifecycle events.