Skip to content

Commit

Permalink
Merge pull request #2602 from erikgb/fix-komega-godoc-examples
Browse files Browse the repository at this point in the history
📖 Fix komega godoc examples
  • Loading branch information
k8s-ci-robot committed Dec 2, 2023
2 parents a50d5d7 + ddba256 commit 1657cf6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
6 changes: 2 additions & 4 deletions pkg/envtest/komega/default.go
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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

0 comments on commit 1657cf6

Please sign in to comment.