mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-10 12:32:03 +00:00
e2e: replace gomega.HaveLen(0) with gomega.BeEmpty()
The failure message becomes nicer. Found with the new ginkgolinter, for example: test/e2e/apps/cronjob.go:113:3: ginkgo-linter: wrong length assertion; consider using `gomega.Expect(jobs.Items).To(gomega.BeEmpty())` instead (ginkgolinter) gomega.Expect(jobs.Items).To(gomega.HaveLen(0)) ^
This commit is contained in:
parent
e7df337eba
commit
f618e61332
@ -110,7 +110,7 @@ var _ = SIGDescribe("CronJob", func() {
|
||||
ginkgo.By("Ensuring no job exists by listing jobs explicitly")
|
||||
jobs, err := f.ClientSet.BatchV1().Jobs(f.Namespace.Name).List(ctx, metav1.ListOptions{})
|
||||
framework.ExpectNoError(err, "Failed to list the CronJobs in namespace %s", f.Namespace.Name)
|
||||
gomega.Expect(jobs.Items).To(gomega.HaveLen(0))
|
||||
gomega.Expect(jobs.Items).To(gomega.BeEmpty())
|
||||
|
||||
ginkgo.By("Removing cronjob")
|
||||
err = deleteCronJob(ctx, f.ClientSet, f.Namespace.Name, cronJob.Name)
|
||||
|
@ -695,7 +695,7 @@ func stopDeployment(ctx context.Context, c clientset.Interface, ns, deploymentNa
|
||||
options := metav1.ListOptions{LabelSelector: selector.String()}
|
||||
rss, err := c.AppsV1().ReplicaSets(ns).List(ctx, options)
|
||||
framework.ExpectNoError(err)
|
||||
gomega.Expect(rss.Items).Should(gomega.HaveLen(0))
|
||||
gomega.Expect(rss.Items).Should(gomega.BeEmpty())
|
||||
framework.Logf("Ensuring deployment %s's Pods were deleted", deploymentName)
|
||||
var pods *v1.PodList
|
||||
if err := wait.PollImmediate(time.Second, timeout, func() (bool, error) {
|
||||
|
Loading…
Reference in New Issue
Block a user