Skip to content
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

📖 Use Should instead of To in komega samples #2770

Merged
merged 1 commit into from
Apr 11, 2024
Merged
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
12 changes: 6 additions & 6 deletions pkg/envtest/komega/default.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func checkDefaultClient() {
// It can be used with gomega.Eventually() like this
//
// deployment := appsv1.Deployment{ ... }
// gomega.Eventually(komega.Get(&deployment)).To(gomega.Succeed())
// gomega.Eventually(komega.Get(&deployment)).Should(gomega.Succeed())
//
// By calling the returned function directly it can also be used with gomega.Expect(komega.Get(...)()).To(...)
func Get(obj client.Object) func() error {
Expand All @@ -41,7 +41,7 @@ func Get(obj client.Object) func() error {
// It can be used with gomega.Eventually() like this
//
// deployments := v1.DeploymentList{ ... }
// gomega.Eventually(k.List(&deployments)).To(gomega.Succeed())
// gomega.Eventually(k.List(&deployments)).Should(gomega.Succeed())
//
// By calling the returned function directly it can also be used as gomega.Expect(k.List(...)()).To(...)
func List(list client.ObjectList, opts ...client.ListOption) func() error {
Expand All @@ -55,7 +55,7 @@ func List(list client.ObjectList, opts ...client.ListOption) func() error {
// deployment := appsv1.Deployment{ ... }
// gomega.Eventually(k.Update(&deployment, func() {
// deployment.Spec.Replicas = 3
// })).To(gomega.Succeed())
// })).Should(gomega.Succeed())
//
// By calling the returned function directly it can also be used as gomega.Expect(k.Update(...)()).To(...)
func Update(obj client.Object, f func(), opts ...client.UpdateOption) func() error {
Expand All @@ -69,7 +69,7 @@ func Update(obj client.Object, f func(), opts ...client.UpdateOption) func() err
// deployment := appsv1.Deployment{ ... }
// gomega.Eventually(k.UpdateStatus(&deployment, func() {
// deployment.Status.AvailableReplicas = 1
// })).To(gomega.Succeed())
// })).Should(gomega.Succeed())
//
// By calling the returned function directly it can also be used as gomega.Expect(k.UpdateStatus(...)()).To(...)
func UpdateStatus(obj client.Object, f func(), opts ...client.SubResourceUpdateOption) func() error {
Expand All @@ -81,7 +81,7 @@ func UpdateStatus(obj client.Object, f func(), opts ...client.SubResourceUpdateO
// It can be used with gomega.Eventually() like this:
//
// deployment := appsv1.Deployment{ ... }
// gomega.Eventually(k.Object(&deployment)).To(HaveField("Spec.Replicas", gomega.Equal(ptr.To(3))))
// gomega.Eventually(k.Object(&deployment)).Should(HaveField("Spec.Replicas", gomega.Equal(ptr.To(3))))
//
// By calling the returned function directly it can also be used as gomega.Expect(k.Object(...)()).To(...)
func Object(obj client.Object) func() (client.Object, error) {
Expand All @@ -93,7 +93,7 @@ func Object(obj client.Object) func() (client.Object, error) {
// It can be used with gomega.Eventually() like this:
//
// deployments := appsv1.DeploymentList{ ... }
// gomega.Eventually(k.ObjectList(&deployments)).To(HaveField("Items", HaveLen(1)))
// gomega.Eventually(k.ObjectList(&deployments)).Should(HaveField("Items", HaveLen(1)))
//
// By calling the returned function directly it can also be used as gomega.Expect(k.ObjectList(...)()).To(...)
func ObjectList(list client.ObjectList, opts ...client.ListOption) func() (client.ObjectList, error) {
Expand Down