change BeTrue to Equal or BeNumerically in cronjob e2e test

This commit is contained in:
toyoda 2019-05-24 13:21:48 +09:00
parent cdff17a96b
commit 749e76351f

View File

@ -72,7 +72,7 @@ var _ = SIGDescribe("CronJob", func() {
jobs, err := f.ClientSet.BatchV1().Jobs(f.Namespace.Name).List(metav1.ListOptions{}) jobs, err := f.ClientSet.BatchV1().Jobs(f.Namespace.Name).List(metav1.ListOptions{})
framework.ExpectNoError(err, "Failed to list the CronJobs in namespace %s", f.Namespace.Name) framework.ExpectNoError(err, "Failed to list the CronJobs in namespace %s", f.Namespace.Name)
activeJobs, _ := filterActiveJobs(jobs) activeJobs, _ := filterActiveJobs(jobs)
gomega.Expect(len(activeJobs) >= 2).To(gomega.BeTrue()) gomega.Expect(len(activeJobs)).To(gomega.BeNumerically(">=", 2))
ginkgo.By("Removing cronjob") ginkgo.By("Removing cronjob")
err = deleteCronJob(f.ClientSet, f.Namespace.Name, cronJob.Name) err = deleteCronJob(f.ClientSet, f.Namespace.Name, cronJob.Name)
@ -249,7 +249,7 @@ var _ = SIGDescribe("CronJob", func() {
jobs, err := f.ClientSet.BatchV1().Jobs(f.Namespace.Name).List(metav1.ListOptions{}) jobs, err := f.ClientSet.BatchV1().Jobs(f.Namespace.Name).List(metav1.ListOptions{})
framework.ExpectNoError(err, "Failed to ensure a finished cronjob exists by listing jobs explicitly in namespace %s", f.Namespace.Name) framework.ExpectNoError(err, "Failed to ensure a finished cronjob exists by listing jobs explicitly in namespace %s", f.Namespace.Name)
_, finishedJobs := filterActiveJobs(jobs) _, finishedJobs := filterActiveJobs(jobs)
gomega.Expect(len(finishedJobs) == 1).To(gomega.BeTrue()) gomega.Expect(len(finishedJobs)).To(gomega.Equal(1))
// Job should get deleted when the next job finishes the next minute // Job should get deleted when the next job finishes the next minute
ginkgo.By("Ensuring this job and its pods does not exist anymore") ginkgo.By("Ensuring this job and its pods does not exist anymore")
@ -262,7 +262,7 @@ var _ = SIGDescribe("CronJob", func() {
jobs, err = f.ClientSet.BatchV1().Jobs(f.Namespace.Name).List(metav1.ListOptions{}) jobs, err = f.ClientSet.BatchV1().Jobs(f.Namespace.Name).List(metav1.ListOptions{})
framework.ExpectNoError(err, "Failed to ensure there is one finished job by listing job explicitly in namespace %s", f.Namespace.Name) framework.ExpectNoError(err, "Failed to ensure there is one finished job by listing job explicitly in namespace %s", f.Namespace.Name)
_, finishedJobs = filterActiveJobs(jobs) _, finishedJobs = filterActiveJobs(jobs)
gomega.Expect(len(finishedJobs) == 1).To(gomega.BeTrue()) gomega.Expect(len(finishedJobs)).To(gomega.Equal(1))
ginkgo.By("Removing cronjob") ginkgo.By("Removing cronjob")
err = deleteCronJob(f.ClientSet, f.Namespace.Name, cronJob.Name) err = deleteCronJob(f.ClientSet, f.Namespace.Name, cronJob.Name)