-
Notifications
You must be signed in to change notification settings - Fork 48
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
Added e2e test for operator resolution #103
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
??
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think package e2e is fine - there's only tests and test tooling here...no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah that's right, I feel like I usually just see that convention when we have
actualpkg
and then when we test itactualpkg_test