Skip to content
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
18 changes: 2 additions & 16 deletions test/e2e/e2e_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package e2e

import (
"context"
"os"
"testing"
"time"

Expand All @@ -12,10 +11,8 @@ import (
corev1 "k8s.io/api/core/v1"
"k8s.io/utils/env"

"k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/types"
"k8s.io/client-go/rest"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/client"
Expand All @@ -27,9 +24,8 @@ import (
)

var (
cfg *rest.Config
c client.Client
operatorCatalog *catalogd.Catalog
cfg *rest.Config
c client.Client
)

const (
Expand Down Expand Up @@ -63,11 +59,6 @@ var _ = BeforeSuite(func() {

c, err = client.New(cfg, client.Options{Scheme: scheme})
Expect(err).To(Not(HaveOccurred()))

ctx := context.Background()
operatorCatalog, err = createTestCatalog(ctx, testCatalogName, os.Getenv(testCatalogRefEnvVar))
Expect(err).ToNot(HaveOccurred())

})

var _ = AfterSuite(func() {
Expand All @@ -76,11 +67,6 @@ var _ = AfterSuite(func() {
// get all the artifacts from the test run and save them to the artifact path
getArtifactsOutput(ctx, basePath)
}
Expect(c.Delete(ctx, operatorCatalog)).To(Succeed())
Eventually(func(g Gomega) {
err := c.Get(ctx, types.NamespacedName{Name: operatorCatalog.Name}, &catalogd.Catalog{})
g.Expect(errors.IsNotFound(err)).To(BeTrue())
}).Should(Succeed())
})

// createTestCatalog will create a new catalog on the test cluster, provided
Expand Down
18 changes: 15 additions & 3 deletions test/e2e/install_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,20 +34,32 @@ const (

var _ = Describe("Operator Install", func() {
var (
ctx context.Context
operatorName string
operator *operatorv1alpha1.Operator
ctx context.Context
operatorCatalog *catalogd.Catalog
operatorName string
operator *operatorv1alpha1.Operator
)
When("An operator is installed from an operator catalog", func() {
BeforeEach(func() {
ctx = context.Background()
var err error
operatorCatalog, err = createTestCatalog(ctx, testCatalogName, os.Getenv(testCatalogRefEnvVar))
Expect(err).ToNot(HaveOccurred())

operatorName = fmt.Sprintf("operator-%s", rand.String(8))
operator = &operatorv1alpha1.Operator{
ObjectMeta: metav1.ObjectMeta{
Name: operatorName,
},
}
})
AfterEach(func() {
Expect(c.Delete(ctx, operatorCatalog)).To(Succeed())
Eventually(func(g Gomega) {
err := c.Get(ctx, types.NamespacedName{Name: operatorCatalog.Name}, &catalogd.Catalog{})
g.Expect(errors.IsNotFound(err)).To(BeTrue())
}).Should(Succeed())
})
When("the operator bundle format is registry+v1", func() {
BeforeEach(func() {
operator.Spec = operatorv1alpha1.OperatorSpec{
Expand Down