-
Notifications
You must be signed in to change notification settings - Fork 1.6k
🐛 Nit: trim unncessary if check in templates/controllers/controller-test.go #2838
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -85,19 +85,13 @@ var _ = Describe("Busybox controller", func() { | |
| } | ||
|
|
||
| err = k8sClient.Create(ctx, busybox) | ||
| if err != nil { | ||
| Expect(err).To(Not(HaveOccurred())) | ||
| } | ||
| Expect(err).To(Not(HaveOccurred())) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hi @LittleWat, Thank you for the contribution 🥇. But this change cannot be done in the samples. the samples are generated automatically when we run Therefore, this change needs to be done in the plugin implementation: https://github.com/kubernetes-sigs/kubebuilder/blob/master/pkg/plugins/golang/deploy-image/v1alpha1/scaffolds/internal/templates/controllers/controller-test.go#L138-L140 Could you please do that in the code implementation and run make generate to ensure that all samples will be updated according to, squash the commits and push it so we are able to get this one merged? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also, please note that you need assign to the CLA. #2838 (comment) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @camilamacedo86 Thank you for the quick and detailed review! Oh, these test codes are generated, cool! I edited the original template file and did |
||
| } | ||
|
|
||
| By("Checking if the custom resource was successfully created") | ||
| Eventually(func() error { | ||
| found := &examplecomv1alpha1.Busybox{} | ||
| err = k8sClient.Get(ctx, typeNamespaceName, found) | ||
| if err != nil { | ||
| return err | ||
| } | ||
| return nil | ||
| return k8sClient.Get(ctx, typeNamespaceName, found) | ||
| }, time.Minute, time.Second).Should(Succeed()) | ||
|
|
||
| By("Reconciling the custom resource created") | ||
|
|
@@ -114,11 +108,7 @@ var _ = Describe("Busybox controller", func() { | |
| By("Checking if Deployment was successfully created in the reconciliation") | ||
| Eventually(func() error { | ||
| found := &appsv1.Deployment{} | ||
| err = k8sClient.Get(ctx, typeNamespaceName, found) | ||
| if err != nil { | ||
| return err | ||
| } | ||
| return nil | ||
| return k8sClient.Get(ctx, typeNamespaceName, found) | ||
| }, time.Minute, time.Second).Should(Succeed()) | ||
| }) | ||
| }) | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
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.
this is the same as
https://github.com/openshift/operator-framework-olm/blob/956fa85d8d9ccee89b567384d61ad009048ea853/staging/operator-lifecycle-manager/pkg/controller/operators/openshift/clusteroperator_controller_test.go#L63