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

📖 Fix komega godoc examples #2602

Merged
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 2 additions & 4 deletions pkg/envtest/komega/default.go
Expand Up @@ -53,9 +53,8 @@ func List(list client.ObjectList, opts ...client.ListOption) func() error {
// It can be used with gomega.Eventually() like this:
//
// deployment := appsv1.Deployment{ ... }
// gomega.Eventually(k.Update(&deployment, func (o client.Object) {
// gomega.Eventually(k.Update(&deployment, func() {
// deployment.Spec.Replicas = 3
// return &deployment
// })).To(gomega.Succeed())
//
// By calling the returned function directly it can also be used as gomega.Expect(k.Update(...)()).To(...)
Expand All @@ -68,9 +67,8 @@ func Update(obj client.Object, f func(), opts ...client.UpdateOption) func() err
// It can be used with gomega.Eventually() like this:
//
// deployment := appsv1.Deployment{ ... }
// gomega.Eventually(k.UpdateStatus(&deployment, func (o client.Object) {
// gomega.Eventually(k.UpdateStatus(&deployment, func() {
// deployment.Status.AvailableReplicas = 1
// return &deployment
// })).To(gomega.Succeed())
//
// By calling the returned function directly it can also be used as gomega.Expect(k.UpdateStatus(...)()).To(...)
Expand Down
6 changes: 2 additions & 4 deletions pkg/envtest/komega/interfaces.go
Expand Up @@ -42,19 +42,17 @@ type Komega interface {
// Update returns a function that fetches a resource, applies the provided update function and then updates the resource.
// It can be used with gomega.Eventually() like this:
// deployment := appsv1.Deployment{ ... }
// gomega.Eventually(k.Update(&deployment, func (o client.Object) {
// gomega.Eventually(k.Update(&deployment, func() {
// deployment.Spec.Replicas = 3
// return &deployment
// })).To(gomega.Succeed())
// By calling the returned function directly it can also be used as gomega.Expect(k.Update(...)()).To(...)
Update(client.Object, func(), ...client.UpdateOption) func() error

// UpdateStatus returns a function that fetches a resource, applies the provided update function and then updates the resource's status.
// It can be used with gomega.Eventually() like this:
// deployment := appsv1.Deployment{ ... }
// gomega.Eventually(k.Update(&deployment, func (o client.Object) {
// gomega.Eventually(k.Update(&deployment, func() {
// deployment.Status.AvailableReplicas = 1
// return &deployment
// })).To(gomega.Succeed())
// By calling the returned function directly it can also be used as gomega.Expect(k.UpdateStatus(...)()).To(...)
UpdateStatus(client.Object, func(), ...client.SubResourceUpdateOption) func() error
Expand Down