-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added e2e test for operator resolution, fixed unit-test gh action run…
…ning e2e tests (#103) Signed-off-by: dtfranz <[email protected]>
- Loading branch information
Showing
4 changed files
with
62 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,4 +29,4 @@ jobs: | |
- name: Run basic unit tests | ||
run: | | ||
make test | ||
make test-unit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
package e2e | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
"time" | ||
|
||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
"k8s.io/apimachinery/pkg/types" | ||
"k8s.io/apimachinery/pkg/util/rand" | ||
|
||
. "github.com/onsi/ginkgo/v2" | ||
. "github.com/onsi/gomega" | ||
operatorv1alpha1 "github.com/operator-framework/operator-controller/api/v1alpha1" | ||
) | ||
|
||
const ( | ||
defaultTimeout = 30 * time.Second | ||
defaultPoll = 1 * time.Second | ||
) | ||
|
||
var _ = Describe("Operator Install", func() { | ||
It("resolves the specified package with correct bundle path", func() { | ||
var ( | ||
ctx context.Context = context.Background() | ||
pkgName string = "prometheus" | ||
operator *operatorv1alpha1.Operator = &operatorv1alpha1.Operator{ | ||
ObjectMeta: metav1.ObjectMeta{ | ||
Name: fmt.Sprintf("operator-%s", rand.String(8)), | ||
}, | ||
Spec: operatorv1alpha1.OperatorSpec{ | ||
PackageName: pkgName, | ||
}, | ||
} | ||
) | ||
ctx = context.Background() | ||
By("creating the Operator resource") | ||
err := c.Create(ctx, operator) | ||
Expect(err).ToNot(HaveOccurred()) | ||
|
||
// TODO dfranz: This test currently relies on the hard-coded CatalogSources found in bundle_cache.go | ||
// and should be re-worked to use a real or test catalog source when the hard-coded stuff is removed | ||
By("eventually reporting a successful resolution and bundle path") | ||
Eventually(func(g Gomega) { | ||
err = c.Get(ctx, types.NamespacedName{Name: operator.Name}, operator) | ||
g.Expect(err).ToNot(HaveOccurred()) | ||
g.Expect(len(operator.Status.Conditions)).To(Equal(1)) | ||
g.Expect(operator.Status.Conditions[0].Message).To(Equal("resolution was successful")) | ||
}).WithTimeout(defaultTimeout).WithPolling(defaultPoll).Should(Succeed()) | ||
|
||
By("deleting the Operator resource") | ||
err = c.Delete(ctx, operator) | ||
Expect(err).ToNot(HaveOccurred()) | ||
}) | ||
}) |
This file was deleted.
Oops, something went wrong.