diff --git a/test/e2e/apimachinery/aggregator.go b/test/e2e/apimachinery/aggregator.go index 97b467425d9..d01d529344f 100644 --- a/test/e2e/apimachinery/aggregator.go +++ b/test/e2e/apimachinery/aggregator.go @@ -47,12 +47,14 @@ import ( e2eauth "k8s.io/kubernetes/test/e2e/framework/auth" e2edeployment "k8s.io/kubernetes/test/e2e/framework/deployment" e2epod "k8s.io/kubernetes/test/e2e/framework/pod" + "k8s.io/kubernetes/test/utils/format" imageutils "k8s.io/kubernetes/test/utils/image" admissionapi "k8s.io/pod-security-admission/api" samplev1alpha1 "k8s.io/sample-apiserver/pkg/apis/wardle/v1alpha1" "k8s.io/utils/pointer" "github.com/onsi/ginkgo/v2" + "github.com/onsi/gomega" ) const ( @@ -436,9 +438,10 @@ func TestSampleAPIServer(ctx context.Context, f *framework.Framework, aggrclient if err := result.Into(u); err != nil { framework.ExpectNoError(err, "reading created response") } - framework.ExpectEqual(u.GetAPIVersion(), apiServiceGroupName+"/"+apiServiceVersion) - framework.ExpectEqual(u.GetKind(), "Flunder") - framework.ExpectEqual(u.GetName(), flunderName) + + gomega.Expect(u.GetAPIVersion()).To(gomega.Equal(apiServiceGroupName + "/" + apiServiceVersion)) + gomega.Expect(u.GetKind()).To(gomega.Equal("Flunder")) + gomega.Expect(u.GetName()).To(gomega.Equal(flunderName)) pods, err := client.CoreV1().Pods(n.namespace).List(ctx, metav1.ListOptions{}) framework.ExpectNoError(err, "getting pods for flunders service") @@ -516,7 +519,7 @@ func TestSampleAPIServer(ctx context.Context, f *framework.Framework, aggrclient var jr *apiregistrationv1.APIService err = json.Unmarshal([]byte(statusContent), &jr) framework.ExpectNoError(err, "Failed to process statusContent: %v | err: %v ", string(statusContent), err) - framework.ExpectEqual(jr.Status.Conditions[0].Message, "all checks passed", "The Message returned was %v", jr.Status.Conditions[0].Message) + gomega.Expect(jr.Status.Conditions[0].Message).To(gomega.Equal("all checks passed"), "The Message returned was %v", jr.Status.Conditions[0].Message) ginkgo.By("kubectl patch apiservice " + apiServiceName + " -p '{\"spec\":{\"versionPriority\": 400}}'") patchContent, err := restClient.Patch(types.MergePatchType). @@ -527,7 +530,7 @@ func TestSampleAPIServer(ctx context.Context, f *framework.Framework, aggrclient framework.ExpectNoError(err, "Patch failed for .../apiservices/"+apiServiceName+". Error: %v", err) err = json.Unmarshal([]byte(patchContent), &jr) framework.ExpectNoError(err, "Failed to process patchContent: %v | err: %v ", string(patchContent), err) - framework.ExpectEqual(jr.Spec.VersionPriority, int32(400), "The VersionPriority returned was %d", jr.Spec.VersionPriority) + gomega.Expect(jr.Spec.VersionPriority).To(gomega.Equal(int32(400)), "The VersionPriority returned was %d", jr.Spec.VersionPriority) ginkgo.By("List APIServices") listApiservices, err := restClient.Get(). @@ -616,7 +619,9 @@ func TestSampleAPIServer(ctx context.Context, f *framework.Framework, aggrclient framework.Logf("Observed APIService %v with Labels: %v & Condition: %v", wardle.ObjectMeta.Name, wardle.Labels, cond) } } - framework.ExpectEqual(foundUpdatedStatusCondition, true, "The updated status condition was not found. %#v", wardle.Status.Conditions) + if !foundUpdatedStatusCondition { + framework.Failf("The updated status condition was not found in:\n%s", format.Object(wardle.Status.Conditions, 1)) + } framework.Logf("Found updated status condition for %s", wardle.ObjectMeta.Name) ginkgo.By(fmt.Sprintf("Replace APIService %s", apiServiceName)) @@ -632,7 +637,7 @@ func TestSampleAPIServer(ctx context.Context, f *framework.Framework, aggrclient return err }) framework.ExpectNoError(err) - framework.ExpectEqual(updatedApiService.Labels[apiServiceName], "updated", "should have the updated label but have %q", updatedApiService.Labels[apiServiceName]) + gomega.Expect(updatedApiService.Labels).To(gomega.HaveKeyWithValue(apiServiceName, "updated"), "should have the updated label but have %q", updatedApiService.Labels[apiServiceName]) framework.Logf("Found updated apiService label for %q", apiServiceName) // kubectl delete flunder test-flunder @@ -714,7 +719,9 @@ func TestSampleAPIServer(ctx context.Context, f *framework.Framework, aggrclient framework.Logf("Observed APIService %v with Labels: %v & Conditions: %v", wardle.ObjectMeta.Name, wardle.Labels, cond) } } - framework.ExpectEqual(foundPatchedStatusCondition, true, "The patched status condition was not found. %#v", wardle.Status.Conditions) + if !foundPatchedStatusCondition { + framework.Failf("The patched status condition was not found in:\n%s", format.Object(wardle.Status.Conditions, 1)) + } framework.Logf("Found patched status condition for %s", wardle.ObjectMeta.Name) ginkgo.By(fmt.Sprintf("APIService deleteCollection with labelSelector: %q", apiServiceLabelSelector)) diff --git a/test/e2e/apimachinery/apiserver_identity.go b/test/e2e/apimachinery/apiserver_identity.go index 9a2b0c52be4..ef60153b9db 100644 --- a/test/e2e/apimachinery/apiserver_identity.go +++ b/test/e2e/apimachinery/apiserver_identity.go @@ -27,6 +27,7 @@ import ( "time" "github.com/onsi/ginkgo/v2" + "github.com/onsi/gomega" "golang.org/x/crypto/cryptobyte" v1 "k8s.io/api/core/v1" @@ -120,7 +121,7 @@ var _ = SIGDescribe("kube-apiserver identity [Feature:APIServerIdentity]", func( LabelSelector: "apiserver.kubernetes.io/identity=kube-apiserver", }) framework.ExpectNoError(err) - framework.ExpectEqual(len(leases.Items), len(controlPlaneNodes), "unexpected number of leases") + gomega.Expect(leases.Items).To(gomega.HaveLen(len(controlPlaneNodes)), "unexpected number of leases") for _, node := range controlPlaneNodes { hostname, err := getControlPlaneHostname(ctx, &node) @@ -176,6 +177,6 @@ var _ = SIGDescribe("kube-apiserver identity [Feature:APIServerIdentity]", func( LabelSelector: "apiserver.kubernetes.io/identity=kube-apiserver", }) framework.ExpectNoError(err) - framework.ExpectEqual(len(leases.Items), len(controlPlaneNodes), "unexpected number of leases") + gomega.Expect(leases.Items).To(gomega.HaveLen(len(controlPlaneNodes)), "unexpected number of leases") }) }) diff --git a/test/e2e/apimachinery/chunking.go b/test/e2e/apimachinery/chunking.go index 32a7a6a5c5f..e075159a45d 100644 --- a/test/e2e/apimachinery/chunking.go +++ b/test/e2e/apimachinery/chunking.go @@ -90,7 +90,7 @@ var _ = SIGDescribe("Servers with support for API chunking", func() { if len(lastRV) == 0 { lastRV = list.ResourceVersion } - framework.ExpectEqual(list.ResourceVersion, lastRV) + gomega.Expect(list.ResourceVersion).To(gomega.Equal(lastRV)) if list.GetContinue() == "" { gomega.Expect(list.GetRemainingItemCount()).To(gomega.BeNil()) } else { @@ -98,7 +98,7 @@ var _ = SIGDescribe("Servers with support for API chunking", func() { gomega.Expect(int(*list.GetRemainingItemCount()) + len(list.Items) + found).To(gomega.BeNumerically("==", numberOfTotalResources)) } for _, item := range list.Items { - framework.ExpectEqual(item.Name, fmt.Sprintf("template-%04d", found)) + gomega.Expect(item.Name).To(gomega.Equal(fmt.Sprintf("template-%04d", found))) found++ } if len(list.Continue) == 0 { @@ -177,7 +177,7 @@ var _ = SIGDescribe("Servers with support for API chunking", func() { gomega.Expect(int(*list.GetRemainingItemCount()) + len(list.Items) + found).To(gomega.BeNumerically("==", numberOfTotalResources)) } for _, item := range list.Items { - framework.ExpectEqual(item.Name, fmt.Sprintf("template-%04d", found)) + gomega.Expect(item.Name).To(gomega.Equal(fmt.Sprintf("template-%04d", found))) found++ } @@ -195,9 +195,9 @@ var _ = SIGDescribe("Servers with support for API chunking", func() { } framework.Logf("Retrieved %d/%d results with rv %s and continue %s", len(list.Items), opts.Limit, list.ResourceVersion, list.Continue) gomega.Expect(len(list.Items)).To(gomega.BeNumerically("<=", opts.Limit)) - framework.ExpectEqual(list.ResourceVersion, lastRV) + gomega.Expect(list.ResourceVersion).To(gomega.Equal(lastRV)) for _, item := range list.Items { - framework.ExpectEqual(item.Name, fmt.Sprintf("template-%04d", found)) + gomega.Expect(item.Name).To(gomega.Equal(fmt.Sprintf("template-%04d", found))) found++ } if len(list.Continue) == 0 { diff --git a/test/e2e/apimachinery/crd_conversion_webhook.go b/test/e2e/apimachinery/crd_conversion_webhook.go index 6942d935f6f..541b2145220 100644 --- a/test/e2e/apimachinery/crd_conversion_webhook.go +++ b/test/e2e/apimachinery/crd_conversion_webhook.go @@ -37,6 +37,7 @@ import ( "k8s.io/kubernetes/test/e2e/framework" e2edeployment "k8s.io/kubernetes/test/e2e/framework/deployment" "k8s.io/kubernetes/test/utils/crd" + "k8s.io/kubernetes/test/utils/format" imageutils "k8s.io/kubernetes/test/utils/image" admissionapi "k8s.io/pod-security-admission/api" "k8s.io/utils/pointer" @@ -460,18 +461,22 @@ func testCRListConversion(ctx context.Context, f *framework.Framework, testCrd * ginkgo.By("List CRs in v1") list, err := customResourceClients["v1"].List(ctx, metav1.ListOptions{}) framework.ExpectNoError(err) - gomega.Expect(len(list.Items)).To(gomega.BeIdenticalTo(2)) - framework.ExpectEqual((list.Items[0].GetName() == name1 && list.Items[1].GetName() == name2) || - (list.Items[0].GetName() == name2 && list.Items[1].GetName() == name1), true) + gomega.Expect(list.Items).To(gomega.HaveLen(2)) + if !((list.Items[0].GetName() == name1 && list.Items[1].GetName() == name2) || + (list.Items[0].GetName() == name2 && list.Items[1].GetName() == name1)) { + framework.Failf("failed to find v1 objects with names %s and %s in the list: \n%s", name1, name2, format.Object(list.Items, 1)) + } verifyV1Object(crd, &list.Items[0]) verifyV1Object(crd, &list.Items[1]) ginkgo.By("List CRs in v2") list, err = customResourceClients["v2"].List(ctx, metav1.ListOptions{}) framework.ExpectNoError(err) - gomega.Expect(len(list.Items)).To(gomega.BeIdenticalTo(2)) - framework.ExpectEqual((list.Items[0].GetName() == name1 && list.Items[1].GetName() == name2) || - (list.Items[0].GetName() == name2 && list.Items[1].GetName() == name1), true) + gomega.Expect(list.Items).To(gomega.HaveLen(2)) + if !((list.Items[0].GetName() == name1 && list.Items[1].GetName() == name2) || + (list.Items[0].GetName() == name2 && list.Items[1].GetName() == name1)) { + framework.Failf("failed to find v2 objects with names %s and %s in the list: \n%s", name1, name2, format.Object(list.Items, 1)) + } verifyV2Object(crd, &list.Items[0]) verifyV2Object(crd, &list.Items[1]) } diff --git a/test/e2e/apimachinery/custom_resource_definition.go b/test/e2e/apimachinery/custom_resource_definition.go index 2410a7121e7..258009c1653 100644 --- a/test/e2e/apimachinery/custom_resource_definition.go +++ b/test/e2e/apimachinery/custom_resource_definition.go @@ -23,6 +23,7 @@ import ( "github.com/google/go-cmp/cmp" "github.com/onsi/ginkgo/v2" + "github.com/onsi/gomega" v1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" "k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset" @@ -114,7 +115,7 @@ var _ = SIGDescribe("CustomResourceDefinition resources [Privileged:ClusterAdmin selectorListOpts := metav1.ListOptions{LabelSelector: "e2e-list-test-uuid=" + testUUID} list, err := apiExtensionClient.ApiextensionsV1().CustomResourceDefinitions().List(ctx, selectorListOpts) framework.ExpectNoError(err, "listing CustomResourceDefinitions") - framework.ExpectEqual(len(list.Items), testListSize) + gomega.Expect(list.Items).To(gomega.HaveLen(testListSize)) for _, actual := range list.Items { var expected *v1.CustomResourceDefinition for _, e := range crds { @@ -228,7 +229,7 @@ var _ = SIGDescribe("CustomResourceDefinition resources [Privileged:ClusterAdmin group := &metav1.APIGroup{} err := f.ClientSet.Discovery().RESTClient().Get().AbsPath("/apis/apiextensions.k8s.io").Do(ctx).Into(group) framework.ExpectNoError(err, "fetching /apis/apiextensions.k8s.io") - framework.ExpectEqual(group.Name, v1.GroupName, "verifying API group name in /apis/apiextensions.k8s.io discovery document") + gomega.Expect(group.Name).To(gomega.Equal(v1.GroupName), "verifying API group name in /apis/apiextensions.k8s.io discovery document") ginkgo.By("finding the apiextensions.k8s.io/v1 API group/version in the /apis/apiextensions.k8s.io discovery document") var version *metav1.GroupVersionForDiscovery @@ -246,7 +247,7 @@ var _ = SIGDescribe("CustomResourceDefinition resources [Privileged:ClusterAdmin apiResourceList := &metav1.APIResourceList{} err := f.ClientSet.Discovery().RESTClient().Get().AbsPath("/apis/apiextensions.k8s.io/v1").Do(ctx).Into(apiResourceList) framework.ExpectNoError(err, "fetching /apis/apiextensions.k8s.io/v1") - framework.ExpectEqual(apiResourceList.GroupVersion, v1.SchemeGroupVersion.String(), "verifying API group/version in /apis/apiextensions.k8s.io/v1 discovery document") + gomega.Expect(apiResourceList.GroupVersion).To(gomega.Equal(v1.SchemeGroupVersion.String()), "verifying API group/version in /apis/apiextensions.k8s.io/v1 discovery document") ginkgo.By("finding customresourcedefinitions resources in the /apis/apiextensions.k8s.io/v1 discovery document") var crdResource *metav1.APIResource @@ -344,7 +345,7 @@ var _ = SIGDescribe("CustomResourceDefinition resources [Privileged:ClusterAdmin if !found { framework.Failf("field `a` should have been defaulted in %+v", u2.Object) } - framework.ExpectEqual(v, "A", "\"a\" is defaulted to \"A\"") + gomega.Expect(v).To(gomega.Equal("A"), "\"a\" is defaulted to \"A\"") // Deleting default for a, adding default "B" for b and waiting for the CR to get defaulted on read for b crd, err = apiExtensionClient.ApiextensionsV1().CustomResourceDefinitions().Patch(ctx, crd.Name, types.JSONPatchType, []byte(`[ diff --git a/test/e2e/apimachinery/discovery.go b/test/e2e/apimachinery/discovery.go index eba0985ccf7..70e43a6f984 100644 --- a/test/e2e/apimachinery/discovery.go +++ b/test/e2e/apimachinery/discovery.go @@ -30,6 +30,7 @@ import ( "k8s.io/kubernetes/test/e2e/framework" e2eskipper "k8s.io/kubernetes/test/e2e/framework/skipper" "k8s.io/kubernetes/test/utils/crd" + "k8s.io/kubernetes/test/utils/format" admissionapi "k8s.io/pod-security-admission/api" "github.com/onsi/ginkgo/v2" @@ -155,7 +156,9 @@ var _ = SIGDescribe("Discovery", func() { break } } - framework.ExpectEqual(true, match, "failed to find a valid version for PreferredVersion") + if !match { + framework.Failf("Failed to find a valid version for PreferredVersion %s in versions:\n%s", checkGroup.PreferredVersion.GroupVersion, format.Object(checkGroup.Versions, 1)) + } } }) diff --git a/test/e2e/apimachinery/garbage_collector.go b/test/e2e/apimachinery/garbage_collector.go index 0d88f3e0d1c..1588fec66bb 100644 --- a/test/e2e/apimachinery/garbage_collector.go +++ b/test/e2e/apimachinery/garbage_collector.go @@ -44,10 +44,11 @@ import ( e2emetrics "k8s.io/kubernetes/test/e2e/framework/metrics" e2enode "k8s.io/kubernetes/test/e2e/framework/node" e2epod "k8s.io/kubernetes/test/e2e/framework/pod" + imageutils "k8s.io/kubernetes/test/utils/image" admissionapi "k8s.io/pod-security-admission/api" "github.com/onsi/ginkgo/v2" - imageutils "k8s.io/kubernetes/test/utils/image" + "github.com/onsi/gomega" ) // estimateMaximumPods estimates how many pods the cluster can handle @@ -894,7 +895,7 @@ var _ = SIGDescribe("Garbage collector", func() { if err != nil { framework.Failf("failed to create CustomResourceDefinition: %v", err) } - framework.ExpectEqual(len(definition.Spec.Versions), 1, "custom resource definition should have one version") + gomega.Expect(definition.Spec.Versions).To(gomega.HaveLen(1), "custom resource definition should have one version") version := definition.Spec.Versions[0] // Get a client for the custom resource. @@ -1029,7 +1030,7 @@ var _ = SIGDescribe("Garbage collector", func() { if err != nil { framework.Failf("failed to create CustomResourceDefinition: %v", err) } - framework.ExpectEqual(len(definition.Spec.Versions), 1, "custom resource definition should have one version") + gomega.Expect(definition.Spec.Versions).To(gomega.HaveLen(1), "custom resource definition should have one version") version := definition.Spec.Versions[0] // Get a client for the custom resource. diff --git a/test/e2e/apimachinery/generated_clientset.go b/test/e2e/apimachinery/generated_clientset.go index 0951a94645a..43c85030b88 100644 --- a/test/e2e/apimachinery/generated_clientset.go +++ b/test/e2e/apimachinery/generated_clientset.go @@ -31,10 +31,11 @@ import ( "k8s.io/apimachinery/pkg/watch" "k8s.io/kubernetes/test/e2e/framework" e2epod "k8s.io/kubernetes/test/e2e/framework/pod" + imageutils "k8s.io/kubernetes/test/utils/image" admissionapi "k8s.io/pod-security-admission/api" "github.com/onsi/ginkgo/v2" - imageutils "k8s.io/kubernetes/test/utils/image" + "github.com/onsi/gomega" ) func testingPod(name, value string) v1.Pod { @@ -116,7 +117,7 @@ var _ = SIGDescribe("Generated clientset", func() { if err != nil { framework.Failf("Failed to query for pods: %v", err) } - framework.ExpectEqual(len(pods.Items), 0) + gomega.Expect(pods.Items).To(gomega.BeEmpty()) options = metav1.ListOptions{ LabelSelector: selector, ResourceVersion: pods.ListMeta.ResourceVersion, @@ -141,7 +142,7 @@ var _ = SIGDescribe("Generated clientset", func() { if err != nil { framework.Failf("Failed to query for pods: %v", err) } - framework.ExpectEqual(len(pods.Items), 1) + gomega.Expect(pods.Items).To(gomega.HaveLen(1)) ginkgo.By("verifying pod creation was observed") observeCreation(w) @@ -229,7 +230,7 @@ var _ = SIGDescribe("Generated clientset", func() { if err != nil { framework.Failf("Failed to query for cronJobs: %v", err) } - framework.ExpectEqual(len(cronJobs.Items), 0) + gomega.Expect(cronJobs.Items).To(gomega.BeEmpty()) options = metav1.ListOptions{ LabelSelector: selector, ResourceVersion: cronJobs.ListMeta.ResourceVersion, @@ -254,7 +255,7 @@ var _ = SIGDescribe("Generated clientset", func() { if err != nil { framework.Failf("Failed to query for cronJobs: %v", err) } - framework.ExpectEqual(len(cronJobs.Items), 1) + gomega.Expect(cronJobs.Items).To(gomega.HaveLen(1)) ginkgo.By("verifying cronJob creation was observed") observeCreation(w) @@ -271,6 +272,6 @@ var _ = SIGDescribe("Generated clientset", func() { if err != nil { framework.Failf("Failed to list cronJobs to verify deletion: %v", err) } - framework.ExpectEqual(len(cronJobs.Items), 0) + gomega.Expect(cronJobs.Items).To(gomega.BeEmpty()) }) }) diff --git a/test/e2e/apimachinery/namespace.go b/test/e2e/apimachinery/namespace.go index 703d93c81ec..2d876714a6b 100644 --- a/test/e2e/apimachinery/namespace.go +++ b/test/e2e/apimachinery/namespace.go @@ -29,6 +29,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/types" "k8s.io/apimachinery/pkg/util/intstr" utilrand "k8s.io/apimachinery/pkg/util/rand" "k8s.io/apimachinery/pkg/util/uuid" @@ -42,8 +43,6 @@ import ( "github.com/onsi/ginkgo/v2" "github.com/onsi/gomega" - - "k8s.io/apimachinery/pkg/types" ) func extinguish(ctx context.Context, f *framework.Framework, totalNS int, maxAllowedAfterDel int, maxSeconds int) { @@ -67,7 +66,7 @@ func extinguish(ctx context.Context, f *framework.Framework, totalNS int, maxAll deleteFilter := []string{"nslifetest"} deleted, err := framework.DeleteNamespaces(ctx, f.ClientSet, deleteFilter, nil /* skipFilter */) framework.ExpectNoError(err, "failed to delete namespace(s) containing: %s", deleteFilter) - framework.ExpectEqual(len(deleted), totalNS) + gomega.Expect(deleted).To(gomega.HaveLen(totalNS)) ginkgo.By("Waiting for namespaces to vanish") //Now POLL until all namespaces have been eradicated. @@ -291,7 +290,7 @@ var _ = SIGDescribe("Namespaces [Serial]", func() { ginkgo.By("get the Namespace and ensuring it has the label") namespace, err := f.ClientSet.CoreV1().Namespaces().Get(ctx, namespaceName, metav1.GetOptions{}) framework.ExpectNoError(err, "failed to get Namespace") - framework.ExpectEqual(namespace.ObjectMeta.Labels["testLabel"], "testValue", "namespace not patched") + gomega.Expect(namespace.ObjectMeta.Labels).To(gomega.HaveKeyWithValue("testLabel", "testValue"), "namespace not patched") }) /* @@ -314,7 +313,7 @@ var _ = SIGDescribe("Namespaces [Serial]", func() { framework.ExpectNoError(err, "failed to fetch NamespaceStatus %s", ns) nsStatus, err := unstructuredToNamespace(unstruct) framework.ExpectNoError(err, "Getting the status of the namespace %s", ns) - framework.ExpectEqual(nsStatus.Status.Phase, v1.NamespaceActive, "The phase returned was %v", nsStatus.Status.Phase) + gomega.Expect(nsStatus.Status.Phase).To(gomega.Equal(v1.NamespaceActive), "The phase returned was %v", nsStatus.Status.Phase) framework.Logf("Status: %#v", nsStatus.Status) ginkgo.By("Patch namespace status") @@ -332,9 +331,9 @@ var _ = SIGDescribe("Namespaces [Serial]", func() { []byte(`{"metadata":{"annotations":{"e2e-patched-ns-status":"`+ns+`"}},"status":{"conditions":[`+string(nsConditionJSON)+`]}}`), metav1.PatchOptions{}, "status") framework.ExpectNoError(err, "Failed to patch status. err: %v ", err) - framework.ExpectEqual(patchedStatus.Annotations["e2e-patched-ns-status"], ns, "patched object should have the applied annotation") - framework.ExpectEqual(patchedStatus.Status.Conditions[len(patchedStatus.Status.Conditions)-1].Reason, "E2E", "The Reason returned was %v", patchedStatus.Status.Conditions[0].Reason) - framework.ExpectEqual(patchedStatus.Status.Conditions[len(patchedStatus.Status.Conditions)-1].Message, "Patched by an e2e test", "The Message returned was %v", patchedStatus.Status.Conditions[0].Message) + gomega.Expect(patchedStatus.Annotations).To(gomega.HaveKeyWithValue("e2e-patched-ns-status", ns), "patched object should have the applied annotation") + gomega.Expect(string(patchedStatus.Status.Conditions[len(patchedStatus.Status.Conditions)-1].Reason)).To(gomega.Equal("E2E"), "The Reason returned was %v", patchedStatus.Status.Conditions[0].Reason) + gomega.Expect(string(patchedStatus.Status.Conditions[len(patchedStatus.Status.Conditions)-1].Message)).To(gomega.Equal("Patched by an e2e test"), "The Message returned was %v", patchedStatus.Status.Conditions[0].Reason) framework.Logf("Status.Condition: %#v", patchedStatus.Status.Conditions[len(patchedStatus.Status.Conditions)-1]) ginkgo.By("Update namespace status") @@ -357,9 +356,9 @@ var _ = SIGDescribe("Namespaces [Serial]", func() { return err }) framework.ExpectNoError(err, "failed to update namespace status %s", ns) - framework.ExpectEqual(len(statusUpdated.Status.Conditions), len(statusUpdated.Status.Conditions), fmt.Sprintf("updated object should have the applied condition, got %#v", statusUpdated.Status.Conditions)) - framework.ExpectEqual(string(statusUpdated.Status.Conditions[len(statusUpdated.Status.Conditions)-1].Type), "StatusUpdate", fmt.Sprintf("updated object should have the approved condition, got %#v", statusUpdated.Status.Conditions)) - framework.ExpectEqual(statusUpdated.Status.Conditions[len(statusUpdated.Status.Conditions)-1].Message, "Updated by an e2e test", "The Message returned was %v", statusUpdated.Status.Conditions[0].Message) + gomega.Expect(statusUpdated.Status.Conditions).To(gomega.HaveLen(len(statusUpdated.Status.Conditions)), "updated object should have the applied condition, got %#v", statusUpdated.Status.Conditions) + gomega.Expect(statusUpdated.Status.Conditions[len(statusUpdated.Status.Conditions)-1].Type).To(gomega.Equal("StatusUpdate"), "updated object should have the approved condition, got %#v", statusUpdated.Status.Conditions) + gomega.Expect(statusUpdated.Status.Conditions[len(statusUpdated.Status.Conditions)-1].Message).To(gomega.Equal("Updated by an e2e test"), "The Message returned was %v", statusUpdated.Status.Conditions[0].Message) framework.Logf("Status.Condition: %#v", statusUpdated.Status.Conditions[len(statusUpdated.Status.Conditions)-1]) }) @@ -385,7 +384,7 @@ var _ = SIGDescribe("Namespaces [Serial]", func() { return err }) framework.ExpectNoError(err, "failed to update Namespace: %q", ns) - framework.ExpectEqual(updatedNamespace.ObjectMeta.Labels[ns], "updated", "Failed to update namespace %q. Current Labels: %#v", ns, updatedNamespace.Labels) + gomega.Expect(updatedNamespace.ObjectMeta.Labels).To(gomega.HaveKeyWithValue(ns, "updated"), "Failed to update namespace %q. Current Labels: %#v", ns, updatedNamespace.Labels) framework.Logf("Namespace %q now has labels, %#v", ns, updatedNamespace.Labels) }) diff --git a/test/e2e/apimachinery/resource_quota.go b/test/e2e/apimachinery/resource_quota.go index e9b3cac71eb..fcfb1ff1890 100644 --- a/test/e2e/apimachinery/resource_quota.go +++ b/test/e2e/apimachinery/resource_quota.go @@ -905,22 +905,22 @@ var _ = SIGDescribe("ResourceQuota", func() { ginkgo.By("Getting a ResourceQuota") resourceQuotaResult, err := client.CoreV1().ResourceQuotas(ns).Get(ctx, quotaName, metav1.GetOptions{}) framework.ExpectNoError(err) - framework.ExpectEqual(resourceQuotaResult.Spec.Hard[v1.ResourceCPU], resource.MustParse("1")) - framework.ExpectEqual(resourceQuotaResult.Spec.Hard[v1.ResourceMemory], resource.MustParse("500Mi")) + gomega.Expect(resourceQuotaResult.Spec.Hard).To(gomega.HaveKeyWithValue(v1.ResourceCPU, resource.MustParse("1"))) + gomega.Expect(resourceQuotaResult.Spec.Hard).To(gomega.HaveKeyWithValue(v1.ResourceMemory, resource.MustParse("500Mi"))) ginkgo.By("Updating a ResourceQuota") resourceQuota.Spec.Hard[v1.ResourceCPU] = resource.MustParse("2") resourceQuota.Spec.Hard[v1.ResourceMemory] = resource.MustParse("1Gi") resourceQuotaResult, err = client.CoreV1().ResourceQuotas(ns).Update(ctx, resourceQuota, metav1.UpdateOptions{}) framework.ExpectNoError(err) - framework.ExpectEqual(resourceQuotaResult.Spec.Hard[v1.ResourceCPU], resource.MustParse("2")) - framework.ExpectEqual(resourceQuotaResult.Spec.Hard[v1.ResourceMemory], resource.MustParse("1Gi")) + gomega.Expect(resourceQuotaResult.Spec.Hard).To(gomega.HaveKeyWithValue(v1.ResourceCPU, resource.MustParse("2"))) + gomega.Expect(resourceQuotaResult.Spec.Hard).To(gomega.HaveKeyWithValue(v1.ResourceMemory, resource.MustParse("1Gi"))) ginkgo.By("Verifying a ResourceQuota was modified") resourceQuotaResult, err = client.CoreV1().ResourceQuotas(ns).Get(ctx, quotaName, metav1.GetOptions{}) framework.ExpectNoError(err) - framework.ExpectEqual(resourceQuotaResult.Spec.Hard[v1.ResourceCPU], resource.MustParse("2")) - framework.ExpectEqual(resourceQuotaResult.Spec.Hard[v1.ResourceMemory], resource.MustParse("1Gi")) + gomega.Expect(resourceQuotaResult.Spec.Hard).To(gomega.HaveKeyWithValue(v1.ResourceCPU, resource.MustParse("2"))) + gomega.Expect(resourceQuotaResult.Spec.Hard).To(gomega.HaveKeyWithValue(v1.ResourceMemory, resource.MustParse("1Gi"))) ginkgo.By("Deleting a ResourceQuota") err = deleteResourceQuota(ctx, client, ns, quotaName) @@ -970,20 +970,20 @@ var _ = SIGDescribe("ResourceQuota", func() { ginkgo.By("Getting a ResourceQuota") resourceQuotaResult, err := client.CoreV1().ResourceQuotas(ns).Get(ctx, rqName, metav1.GetOptions{}) framework.ExpectNoError(err) - framework.ExpectEqual(resourceQuotaResult.Spec.Hard[v1.ResourceCPU], resource.MustParse("1")) - framework.ExpectEqual(resourceQuotaResult.Spec.Hard[v1.ResourceMemory], resource.MustParse("500Mi")) + gomega.Expect(resourceQuotaResult.Spec.Hard[v1.ResourceCPU]).To(gomega.Equal(resource.MustParse("1"))) + gomega.Expect(resourceQuotaResult.Spec.Hard[v1.ResourceMemory]).To(gomega.Equal(resource.MustParse("500Mi"))) ginkgo.By("Listing all ResourceQuotas with LabelSelector") rq, err := client.CoreV1().ResourceQuotas("").List(ctx, metav1.ListOptions{LabelSelector: labelSelector}) framework.ExpectNoError(err, "Failed to list job. %v", err) - framework.ExpectEqual(len(rq.Items), 1, "Failed to find ResourceQuotes %v", rqName) + gomega.Expect(rq.Items).To(gomega.HaveLen(1), "Failed to find ResourceQuotes %v", rqName) ginkgo.By("Patching the ResourceQuota") payload := "{\"metadata\":{\"labels\":{\"" + rqName + "\":\"patched\"}},\"spec\":{\"hard\":{ \"memory\":\"750Mi\"}}}" patchedResourceQuota, err := client.CoreV1().ResourceQuotas(ns).Patch(ctx, rqName, types.StrategicMergePatchType, []byte(payload), metav1.PatchOptions{}) framework.ExpectNoError(err, "failed to patch ResourceQuota %s in namespace %s", rqName, ns) - framework.ExpectEqual(patchedResourceQuota.Labels[rqName], "patched", "Did not find the label for this ResourceQuota. Current labels: %v", patchedResourceQuota.Labels) - framework.ExpectEqual(*patchedResourceQuota.Spec.Hard.Memory(), resource.MustParse("750Mi"), "Hard memory value for ResourceQuota %q is %s not 750Mi.", patchedResourceQuota.ObjectMeta.Name, patchedResourceQuota.Spec.Hard.Memory().String()) + gomega.Expect(patchedResourceQuota.Labels[rqName]).To(gomega.Equal("patched"), "Failed to find the label for this ResourceQuota. Current labels: %v", patchedResourceQuota.Labels) + gomega.Expect(*patchedResourceQuota.Spec.Hard.Memory()).To(gomega.Equal(resource.MustParse("750Mi")), "Hard memory value for ResourceQuota %q is %s not 750Mi.", patchedResourceQuota.ObjectMeta.Name, patchedResourceQuota.Spec.Hard.Memory().String()) ginkgo.By("Deleting a Collection of ResourceQuotas") err = client.CoreV1().ResourceQuotas(ns).DeleteCollection(ctx, metav1.DeleteOptions{}, metav1.ListOptions{LabelSelector: labelSelector}) @@ -1046,9 +1046,9 @@ var _ = SIGDescribe("ResourceQuota", func() { initialResourceQuota, err := rqClient.Get(ctx, rqName, metav1.GetOptions{}) framework.ExpectNoError(err) - framework.ExpectEqual(*initialResourceQuota.Spec.Hard.Cpu(), resource.MustParse("500m"), "Hard cpu value for ResourceQuota %q is %s not 500m.", initialResourceQuota.Name, initialResourceQuota.Spec.Hard.Cpu().String()) + gomega.Expect(*initialResourceQuota.Spec.Hard.Cpu()).To(gomega.Equal(resource.MustParse("500m")), "Hard cpu value for ResourceQuota %q is %s not 500m.", initialResourceQuota.Name, initialResourceQuota.Spec.Hard.Cpu().String()) framework.Logf("Resource quota %q reports spec: hard cpu limit of %s", rqName, initialResourceQuota.Spec.Hard.Cpu()) - framework.ExpectEqual(*initialResourceQuota.Spec.Hard.Memory(), resource.MustParse("500Mi"), "Hard memory value for ResourceQuota %q is %s not 500Mi.", initialResourceQuota.Name, initialResourceQuota.Spec.Hard.Memory().String()) + gomega.Expect(*initialResourceQuota.Spec.Hard.Memory()).To(gomega.Equal(resource.MustParse("500Mi")), "Hard memory value for ResourceQuota %q is %s not 500Mi.", initialResourceQuota.Name, initialResourceQuota.Spec.Hard.Memory().String()) framework.Logf("Resource quota %q reports spec: hard memory limit of %s", rqName, initialResourceQuota.Spec.Hard.Memory()) ginkgo.By(fmt.Sprintf("Updating resourceQuota %q /status", rqName)) @@ -1140,9 +1140,9 @@ var _ = SIGDescribe("ResourceQuota", func() { rq, err := unstructuredToResourceQuota(unstruct) framework.ExpectNoError(err, "Getting the status of the resource quota %q", rq.Name) - framework.ExpectEqual(*rq.Status.Hard.Cpu(), resource.MustParse("1"), "Hard cpu value for ResourceQuota %q is %s not 1.", rq.Name, rq.Status.Hard.Cpu().String()) + gomega.Expect(*rq.Status.Hard.Cpu()).To(gomega.Equal(resource.MustParse("1")), "Hard cpu value for ResourceQuota %q is %s not 1.", rq.Name, rq.Status.Hard.Cpu().String()) framework.Logf("Resourcequota %q reports status: hard cpu of %s", rqName, rq.Status.Hard.Cpu()) - framework.ExpectEqual(*rq.Status.Hard.Memory(), resource.MustParse("1Gi"), "Hard memory value for ResourceQuota %q is %s not 1Gi.", rq.Name, rq.Status.Hard.Memory().String()) + gomega.Expect(*rq.Status.Hard.Memory()).To(gomega.Equal(resource.MustParse("1Gi")), "Hard memory value for ResourceQuota %q is %s not 1Gi.", rq.Name, rq.Status.Hard.Memory().String()) framework.Logf("Resourcequota %q reports status: hard memory of %s", rqName, rq.Status.Hard.Memory()) // Sync resourceQuota list before repatching /status @@ -1162,9 +1162,9 @@ var _ = SIGDescribe("ResourceQuota", func() { metav1.PatchOptions{}, "status") framework.ExpectNoError(err) - framework.ExpectEqual(*repatchedResourceQuota.Status.Hard.Cpu(), resource.MustParse("2"), "Hard cpu value for ResourceQuota %q is %s not 2.", repatchedResourceQuota.Name, repatchedResourceQuota.Status.Hard.Cpu().String()) + gomega.Expect(*repatchedResourceQuota.Status.Hard.Cpu()).To(gomega.Equal(resource.MustParse("2")), "Hard cpu value for ResourceQuota %q is %s not 2.", repatchedResourceQuota.Name, repatchedResourceQuota.Status.Hard.Cpu().String()) framework.Logf("Resourcequota %q reports status: hard cpu of %s", repatchedResourceQuota.Name, repatchedResourceQuota.Status.Hard.Cpu()) - framework.ExpectEqual(*repatchedResourceQuota.Status.Hard.Memory(), resource.MustParse("2Gi"), "Hard memory value for ResourceQuota %q is %s not 2Gi.", repatchedResourceQuota.Name, repatchedResourceQuota.Status.Hard.Memory().String()) + gomega.Expect(*repatchedResourceQuota.Status.Hard.Memory()).To(gomega.Equal(resource.MustParse("2Gi")), "Hard memory value for ResourceQuota %q is %s not 2Gi.", repatchedResourceQuota.Name, repatchedResourceQuota.Status.Hard.Memory().String()) framework.Logf("Resourcequota %q reports status: hard memory of %s", repatchedResourceQuota.Name, repatchedResourceQuota.Status.Hard.Memory()) _, err = watchtools.Until(ctxUntil, rqList.ResourceVersion, w, func(event watch.Event) (bool, error) { @@ -1190,8 +1190,8 @@ var _ = SIGDescribe("ResourceQuota", func() { framework.ExpectNoError(err) if apiequality.Semantic.DeepEqual(resourceQuotaResult.Spec.Hard.Cpu(), resourceQuotaResult.Status.Hard.Cpu()) { - framework.ExpectEqual(*resourceQuotaResult.Status.Hard.Cpu(), resource.MustParse("1"), "Hard cpu value for ResourceQuota %q is %s not 1.", repatchedResourceQuota.Name, repatchedResourceQuota.Status.Hard.Cpu().String()) - framework.ExpectEqual(*resourceQuotaResult.Status.Hard.Memory(), resource.MustParse("1Gi"), "Hard memory value for ResourceQuota %q is %s not 1Gi.", repatchedResourceQuota.Name, repatchedResourceQuota.Status.Hard.Memory().String()) + gomega.Expect(*resourceQuotaResult.Status.Hard.Cpu()).To(gomega.Equal(resource.MustParse("1")), "Hard cpu value for ResourceQuota %q is %s not 1.", repatchedResourceQuota.Name, repatchedResourceQuota.Status.Hard.Cpu().String()) + gomega.Expect(*resourceQuotaResult.Status.Hard.Memory()).To(gomega.Equal(resource.MustParse("1Gi")), "Hard memory value for ResourceQuota %q is %s not 1Gi.", repatchedResourceQuota.Name, repatchedResourceQuota.Status.Hard.Memory().String()) framework.Logf("ResourceQuota %q Spec was unchanged and /status reset", resourceQuotaResult.Name) return true, nil diff --git a/test/e2e/apimachinery/server_version.go b/test/e2e/apimachinery/server_version.go index e1d5a656888..26902c5e713 100644 --- a/test/e2e/apimachinery/server_version.go +++ b/test/e2e/apimachinery/server_version.go @@ -25,6 +25,7 @@ import ( admissionapi "k8s.io/pod-security-admission/api" "github.com/onsi/ginkgo/v2" + "github.com/onsi/gomega" ) var _ = SIGDescribe("server version", func() { @@ -47,7 +48,7 @@ var _ = SIGDescribe("server version", func() { ginkgo.By("Confirm major version") re := regexp.MustCompile("[1-9]") - framework.ExpectEqual(re.FindString(version.Major), version.Major, "unable to find major version") + gomega.Expect(re.FindString(version.Major)).To(gomega.Equal(version.Major), "unable to find major version") framework.Logf("Major version: %v", version.Major) ginkgo.By("Confirm minor version") @@ -57,7 +58,7 @@ var _ = SIGDescribe("server version", func() { framework.Logf("cleanMinorVersion: %v", cleanMinorVersion) re = regexp.MustCompile("[0-9]+") - framework.ExpectEqual(re.FindString(version.Minor), cleanMinorVersion, "unable to find minor version") + gomega.Expect(re.FindString(version.Minor)).To(gomega.Equal(cleanMinorVersion), "unable to find minor version") framework.Logf("Minor version: %v", version.Minor) }) }) diff --git a/test/e2e/apimachinery/table_conversion.go b/test/e2e/apimachinery/table_conversion.go index 3a5273020f2..bd5ccef3af2 100644 --- a/test/e2e/apimachinery/table_conversion.go +++ b/test/e2e/apimachinery/table_conversion.go @@ -66,10 +66,10 @@ var _ = SIGDescribe("Servers with support for Table transformation", func() { framework.Logf("Table: %#v", table) gomega.Expect(len(table.ColumnDefinitions)).To(gomega.BeNumerically(">", 2)) - framework.ExpectEqual(len(table.Rows), 1) - framework.ExpectEqual(len(table.Rows[0].Cells), len(table.ColumnDefinitions)) - framework.ExpectEqual(table.ColumnDefinitions[0].Name, "Name") - framework.ExpectEqual(table.Rows[0].Cells[0], podName) + gomega.Expect(table.Rows).To(gomega.HaveLen(1)) + gomega.Expect(table.Rows[0].Cells).To(gomega.HaveLen(len(table.ColumnDefinitions))) + gomega.Expect(table.ColumnDefinitions[0].Name).To(gomega.Equal("Name")) + gomega.Expect(table.Rows[0].Cells[0]).To(gomega.Equal(podName)) out := printTable(table) gomega.Expect(out).To(gomega.MatchRegexp("^NAME\\s")) @@ -111,11 +111,11 @@ var _ = SIGDescribe("Servers with support for Table transformation", func() { SetHeader("Accept", "application/json;as=Table;v=v1beta1;g=meta.k8s.io"). Do(ctx).Into(pagedTable) framework.ExpectNoError(err, "failed to get pod templates in Table form in namespace: %s", ns) - framework.ExpectEqual(len(pagedTable.Rows), 2) + gomega.Expect(pagedTable.Rows).To(gomega.HaveLen(2)) framework.ExpectNotEqual(pagedTable.ResourceVersion, "") framework.ExpectNotEqual(pagedTable.Continue, "") - framework.ExpectEqual(pagedTable.Rows[0].Cells[0], "template-0000") - framework.ExpectEqual(pagedTable.Rows[1].Cells[0], "template-0001") + gomega.Expect(pagedTable.Rows[0].Cells[0]).To(gomega.Equal("template-0000")) + gomega.Expect(pagedTable.Rows[1].Cells[0]).To(gomega.Equal("template-0001")) err = c.CoreV1().RESTClient().Get().Namespace(ns).Resource("podtemplates"). VersionedParams(&metav1.ListOptions{Continue: pagedTable.Continue}, metav1.ParameterCodec). @@ -123,7 +123,7 @@ var _ = SIGDescribe("Servers with support for Table transformation", func() { Do(ctx).Into(pagedTable) framework.ExpectNoError(err, "failed to get pod templates in Table form in namespace: %s", ns) gomega.Expect(pagedTable.Rows).ToNot(gomega.BeEmpty()) - framework.ExpectEqual(pagedTable.Rows[0].Cells[0], "template-0002") + gomega.Expect(pagedTable.Rows[0].Cells[0]).To(gomega.Equal("template-0002")) }) ginkgo.It("should return generic metadata details across all namespaces for nodes", func(ctx context.Context) { @@ -136,8 +136,8 @@ var _ = SIGDescribe("Servers with support for Table transformation", func() { gomega.Expect(len(table.ColumnDefinitions)).To(gomega.BeNumerically(">=", 2)) gomega.Expect(table.Rows).ToNot(gomega.BeEmpty()) - framework.ExpectEqual(len(table.Rows[0].Cells), len(table.ColumnDefinitions)) - framework.ExpectEqual(table.ColumnDefinitions[0].Name, "Name") + gomega.Expect(table.Rows[0].Cells).To(gomega.HaveLen(len(table.ColumnDefinitions))) + gomega.Expect(table.ColumnDefinitions[0].Name).To(gomega.Equal("Name")) framework.ExpectNotEqual(table.ResourceVersion, "") out := printTable(table) @@ -165,7 +165,7 @@ var _ = SIGDescribe("Servers with support for Table transformation", func() { } err := c.AuthorizationV1().RESTClient().Post().Resource("selfsubjectaccessreviews").SetHeader("Accept", "application/json;as=Table;v=v1;g=meta.k8s.io").Body(sar).Do(ctx).Into(table) gomega.Expect(err).To(gomega.HaveOccurred(), "failed to return error when posting self subject access review: %+v, to a backend that does not implement metadata", sar) - framework.ExpectEqual(err.(apierrors.APIStatus).Status().Code, int32(406)) + gomega.Expect(err.(apierrors.APIStatus)).To(gomega.HaveField("Status().Code", gomega.Equal(int32(406)))) }) }) diff --git a/test/e2e/apimachinery/webhook.go b/test/e2e/apimachinery/webhook.go index 9b79d8979fe..ae9e9bfefdd 100644 --- a/test/e2e/apimachinery/webhook.go +++ b/test/e2e/apimachinery/webhook.go @@ -149,7 +149,7 @@ var _ = SIGDescribe("AdmissionWebhook [Privileged:ClusterAdmin]", func() { group := &metav1.APIGroup{} err := client.Discovery().RESTClient().Get().AbsPath("/apis/admissionregistration.k8s.io").Do(ctx).Into(group) framework.ExpectNoError(err, "fetching /apis/admissionregistration.k8s.io") - framework.ExpectEqual(group.Name, admissionregistrationv1.GroupName, "verifying API group name in /apis/admissionregistration.k8s.io discovery document") + gomega.Expect(group.Name).To(gomega.Equal(admissionregistrationv1.GroupName), "verifying API group name in /apis/admissionregistration.k8s.io discovery document") ginkgo.By("finding the admissionregistration.k8s.io/v1 API group/version in the /apis/admissionregistration.k8s.io discovery document") var version *metav1.GroupVersionForDiscovery @@ -167,7 +167,7 @@ var _ = SIGDescribe("AdmissionWebhook [Privileged:ClusterAdmin]", func() { apiResourceList := &metav1.APIResourceList{} err := client.Discovery().RESTClient().Get().AbsPath("/apis/admissionregistration.k8s.io/v1").Do(ctx).Into(apiResourceList) framework.ExpectNoError(err, "fetching /apis/admissionregistration.k8s.io/v1") - framework.ExpectEqual(apiResourceList.GroupVersion, admissionregistrationv1.SchemeGroupVersion.String(), "verifying API group/version in /apis/admissionregistration.k8s.io/v1 discovery document") + gomega.Expect(apiResourceList.GroupVersion).To(gomega.Equal(admissionregistrationv1.SchemeGroupVersion.String()), "verifying API group/version in /apis/admissionregistration.k8s.io/v1 discovery document") ginkgo.By("finding mutatingwebhookconfigurations and validatingwebhookconfigurations resources in the /apis/admissionregistration.k8s.io/v1 discovery document") var ( @@ -592,7 +592,7 @@ var _ = SIGDescribe("AdmissionWebhook [Privileged:ClusterAdmin]", func() { ginkgo.By("Listing all of the created validation webhooks") list, err := client.AdmissionregistrationV1().ValidatingWebhookConfigurations().List(ctx, selectorListOpts) framework.ExpectNoError(err, "Listing validating webhook configurations") - framework.ExpectEqual(len(list.Items), testListSize) + gomega.Expect(list.Items).To(gomega.HaveLen(testListSize)) // ensure backend is ready before proceeding err = waitWebhookConfigurationReady(ctx, f, markersNamespaceName) @@ -666,7 +666,7 @@ var _ = SIGDescribe("AdmissionWebhook [Privileged:ClusterAdmin]", func() { ginkgo.By("Listing all of the created validation webhooks") list, err := client.AdmissionregistrationV1().MutatingWebhookConfigurations().List(ctx, selectorListOpts) framework.ExpectNoError(err, "Listing mutating webhook configurations") - framework.ExpectEqual(len(list.Items), testListSize) + gomega.Expect(list.Items).To(gomega.HaveLen(testListSize)) // ensure backend is ready before proceeding err = waitWebhookConfigurationReady(ctx, f, markersNamespaceName)