Skip to content

Commit 83cac1a

Browse files
committed
Update komega samples
As the `AsyncAssertion` of `gomega` does not support `To` the samples in the documentation have been updated to use `Should`.
1 parent 20f3f4b commit 83cac1a

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

pkg/envtest/komega/default.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ func checkDefaultClient() {
2929
// It can be used with gomega.Eventually() like this
3030
//
3131
// deployment := appsv1.Deployment{ ... }
32-
// gomega.Eventually(komega.Get(&deployment)).To(gomega.Succeed())
32+
// gomega.Eventually(komega.Get(&deployment)).Should(gomega.Succeed())
3333
//
3434
// By calling the returned function directly it can also be used with gomega.Expect(komega.Get(...)()).To(...)
3535
func Get(obj client.Object) func() error {
@@ -41,7 +41,7 @@ func Get(obj client.Object) func() error {
4141
// It can be used with gomega.Eventually() like this
4242
//
4343
// deployments := v1.DeploymentList{ ... }
44-
// gomega.Eventually(k.List(&deployments)).To(gomega.Succeed())
44+
// gomega.Eventually(k.List(&deployments)).Should(gomega.Succeed())
4545
//
4646
// By calling the returned function directly it can also be used as gomega.Expect(k.List(...)()).To(...)
4747
func List(list client.ObjectList, opts ...client.ListOption) func() error {
@@ -55,7 +55,7 @@ func List(list client.ObjectList, opts ...client.ListOption) func() error {
5555
// deployment := appsv1.Deployment{ ... }
5656
// gomega.Eventually(k.Update(&deployment, func() {
5757
// deployment.Spec.Replicas = 3
58-
// })).To(gomega.Succeed())
58+
// })).Should(gomega.Succeed())
5959
//
6060
// By calling the returned function directly it can also be used as gomega.Expect(k.Update(...)()).To(...)
6161
func Update(obj client.Object, f func(), opts ...client.UpdateOption) func() error {
@@ -69,7 +69,7 @@ func Update(obj client.Object, f func(), opts ...client.UpdateOption) func() err
6969
// deployment := appsv1.Deployment{ ... }
7070
// gomega.Eventually(k.UpdateStatus(&deployment, func() {
7171
// deployment.Status.AvailableReplicas = 1
72-
// })).To(gomega.Succeed())
72+
// })).Should(gomega.Succeed())
7373
//
7474
// By calling the returned function directly it can also be used as gomega.Expect(k.UpdateStatus(...)()).To(...)
7575
func UpdateStatus(obj client.Object, f func(), opts ...client.SubResourceUpdateOption) func() error {
@@ -81,7 +81,7 @@ func UpdateStatus(obj client.Object, f func(), opts ...client.SubResourceUpdateO
8181
// It can be used with gomega.Eventually() like this:
8282
//
8383
// deployment := appsv1.Deployment{ ... }
84-
// gomega.Eventually(k.Object(&deployment)).To(HaveField("Spec.Replicas", gomega.Equal(ptr.To(3))))
84+
// gomega.Eventually(k.Object(&deployment)).Should(HaveField("Spec.Replicas", gomega.Equal(ptr.To(3))))
8585
//
8686
// By calling the returned function directly it can also be used as gomega.Expect(k.Object(...)()).To(...)
8787
func Object(obj client.Object) func() (client.Object, error) {
@@ -93,7 +93,7 @@ func Object(obj client.Object) func() (client.Object, error) {
9393
// It can be used with gomega.Eventually() like this:
9494
//
9595
// deployments := appsv1.DeploymentList{ ... }
96-
// gomega.Eventually(k.ObjectList(&deployments)).To(HaveField("Items", HaveLen(1)))
96+
// gomega.Eventually(k.ObjectList(&deployments)).Should(HaveField("Items", HaveLen(1)))
9797
//
9898
// By calling the returned function directly it can also be used as gomega.Expect(k.ObjectList(...)()).To(...)
9999
func ObjectList(list client.ObjectList, opts ...client.ListOption) func() (client.ObjectList, error) {

0 commit comments

Comments
 (0)