Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preparations to ginkgolinter v0.16.0: Expect.Should => Expect.To #2845

Merged
merged 1 commit into from
Mar 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
514 changes: 257 additions & 257 deletions controllers/alerts/metrics_test.go

Large diffs are not rendered by default.

32 changes: 16 additions & 16 deletions controllers/common/hcoConditions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ var _ = Describe("HCO Conditions Tests", func() {
Expect(conds).To(HaveLen(1))

Expect(conds[hcov1beta1.ConditionReconcileComplete]).ToNot(BeNil())
Expect(conds[hcov1beta1.ConditionReconcileComplete].Type).Should(Equal(hcov1beta1.ConditionReconcileComplete))
Expect(conds[hcov1beta1.ConditionReconcileComplete].Status).Should(Equal(metav1.ConditionFalse))
Expect(conds[hcov1beta1.ConditionReconcileComplete].Reason).Should(Equal("reason"))
Expect(conds[hcov1beta1.ConditionReconcileComplete].Message).Should(Equal("a message"))
Expect(conds[hcov1beta1.ConditionReconcileComplete].Type).To(Equal(hcov1beta1.ConditionReconcileComplete))
Expect(conds[hcov1beta1.ConditionReconcileComplete].Status).To(Equal(metav1.ConditionFalse))
Expect(conds[hcov1beta1.ConditionReconcileComplete].Reason).To(Equal("reason"))
Expect(conds[hcov1beta1.ConditionReconcileComplete].Message).To(Equal("a message"))
})

It("Should update a condition if already exists", func() {
Expand All @@ -43,10 +43,10 @@ var _ = Describe("HCO Conditions Tests", func() {
Expect(conds).To(HaveLen(1))

Expect(conds[hcov1beta1.ConditionReconcileComplete]).ToNot(BeNil())
Expect(conds[hcov1beta1.ConditionReconcileComplete].Type).Should(Equal(hcov1beta1.ConditionReconcileComplete))
Expect(conds[hcov1beta1.ConditionReconcileComplete].Status).Should(Equal(metav1.ConditionTrue))
Expect(conds[hcov1beta1.ConditionReconcileComplete].Reason).Should(Equal("reason2"))
Expect(conds[hcov1beta1.ConditionReconcileComplete].Message).Should(Equal("another message"))
Expect(conds[hcov1beta1.ConditionReconcileComplete].Type).To(Equal(hcov1beta1.ConditionReconcileComplete))
Expect(conds[hcov1beta1.ConditionReconcileComplete].Status).To(Equal(metav1.ConditionTrue))
Expect(conds[hcov1beta1.ConditionReconcileComplete].Reason).To(Equal("reason2"))
Expect(conds[hcov1beta1.ConditionReconcileComplete].Message).To(Equal("another message"))
})
})

Expand All @@ -67,10 +67,10 @@ var _ = Describe("HCO Conditions Tests", func() {
Expect(conds).To(HaveLen(1))

Expect(conds[hcov1beta1.ConditionReconcileComplete]).ToNot(BeNil())
Expect(conds[hcov1beta1.ConditionReconcileComplete].Type).Should(Equal(hcov1beta1.ConditionReconcileComplete))
Expect(conds[hcov1beta1.ConditionReconcileComplete].Status).Should(Equal(metav1.ConditionFalse))
Expect(conds[hcov1beta1.ConditionReconcileComplete].Reason).Should(Equal("reason"))
Expect(conds[hcov1beta1.ConditionReconcileComplete].Message).Should(Equal("a message"))
Expect(conds[hcov1beta1.ConditionReconcileComplete].Type).To(Equal(hcov1beta1.ConditionReconcileComplete))
Expect(conds[hcov1beta1.ConditionReconcileComplete].Status).To(Equal(metav1.ConditionFalse))
Expect(conds[hcov1beta1.ConditionReconcileComplete].Reason).To(Equal("reason"))
Expect(conds[hcov1beta1.ConditionReconcileComplete].Message).To(Equal("a message"))

By("The condition should not be changed by this call")
conds.SetStatusConditionIfUnset(metav1.Condition{
Expand All @@ -85,10 +85,10 @@ var _ = Describe("HCO Conditions Tests", func() {

By("Make sure the values are the same as before and were not changed")
Expect(conds[hcov1beta1.ConditionReconcileComplete]).ToNot(BeNil())
Expect(conds[hcov1beta1.ConditionReconcileComplete].Type).Should(Equal(hcov1beta1.ConditionReconcileComplete))
Expect(conds[hcov1beta1.ConditionReconcileComplete].Status).Should(Equal(metav1.ConditionFalse))
Expect(conds[hcov1beta1.ConditionReconcileComplete].Reason).Should(Equal("reason"))
Expect(conds[hcov1beta1.ConditionReconcileComplete].Message).Should(Equal("a message"))
Expect(conds[hcov1beta1.ConditionReconcileComplete].Type).To(Equal(hcov1beta1.ConditionReconcileComplete))
Expect(conds[hcov1beta1.ConditionReconcileComplete].Status).To(Equal(metav1.ConditionFalse))
Expect(conds[hcov1beta1.ConditionReconcileComplete].Reason).To(Equal("reason"))
Expect(conds[hcov1beta1.ConditionReconcileComplete].Message).To(Equal("a message"))
})
})

Expand Down
6 changes: 3 additions & 3 deletions controllers/common/hcoRequest_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ var _ = Describe("Test HcoRequest", func() {
true,
)

Expect(req.Name).Should(Equal("name"))
Expect(req.Namespace).Should(Equal("namespace"))
Expect(req.Ctx).Should(Equal(ctx))
Expect(req.Name).To(Equal("name"))
Expect(req.Namespace).To(Equal("namespace"))
Expect(req.Ctx).To(Equal(ctx))
Expect(req.Conditions).ToNot(BeNil())
Expect(req.Conditions).To(BeEmpty())
Expect(req.UpgradeMode).To(BeFalse())
Expand Down
32 changes: 16 additions & 16 deletions controllers/hyperconverged/dataimportschedule_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,24 +23,24 @@ var _ = Describe("test data import schedule", func() {

applyDataImportSchedule(req)

Expect(dataImportSchedule).Should(MatchRegexp(regex))
Expect(dataImportSchedule).To(MatchRegexp(regex))

rx := regexp.MustCompile(regex)
groups := rx.FindStringSubmatch(dataImportSchedule)
Expect(groups).To(HaveLen(3))
minute, err := strconv.Atoi(groups[1])

Expect(err).ToNot(HaveOccurred())
Expect(minute).Should(BeNumerically(">=", 0), "minute should be grater than or equal to 0; cron expression is: %s", dataImportSchedule)
Expect(minute).Should(BeNumerically("<", 60), "minute should br less than 60; cron expression is: %s", dataImportSchedule)
Expect(minute).To(BeNumerically(">=", 0), "minute should be grater than or equal to 0; cron expression is: %s", dataImportSchedule)
Expect(minute).To(BeNumerically("<", 60), "minute should br less than 60; cron expression is: %s", dataImportSchedule)

hour, err := strconv.Atoi(groups[2])
Expect(err).ToNot(HaveOccurred())
Expect(hour).Should(BeNumerically(">=", 0), "hour should be grater than or equal to 0; cron expression is: %s", dataImportSchedule)
Expect(hour).Should(BeNumerically("<", 12), "hour should br less than 12; cron expression is: %s", dataImportSchedule)
Expect(hour).To(BeNumerically(">=", 0), "hour should be grater than or equal to 0; cron expression is: %s", dataImportSchedule)
Expect(hour).To(BeNumerically("<", 12), "hour should br less than 12; cron expression is: %s", dataImportSchedule)

Expect(hco.Status.DataImportSchedule).Should(Equal(dataImportSchedule))
Expect(req.StatusDirty).Should(BeTrue())
Expect(hco.Status.DataImportSchedule).To(Equal(dataImportSchedule))
Expect(req.StatusDirty).To(BeTrue())
}
})

Expand All @@ -52,9 +52,9 @@ var _ = Describe("test data import schedule", func() {

applyDataImportSchedule(req)

Expect(dataImportSchedule).Should(Equal(schedule))
Expect(hco.Status.DataImportSchedule).Should(Equal(schedule))
Expect(req.StatusDirty).Should(BeTrue())
Expect(dataImportSchedule).To(Equal(schedule))
Expect(hco.Status.DataImportSchedule).To(Equal(schedule))
Expect(req.StatusDirty).To(BeTrue())
})

It("should update the variable if it empty and the status is set", func() {
Expand All @@ -66,9 +66,9 @@ var _ = Describe("test data import schedule", func() {

applyDataImportSchedule(req)

Expect(dataImportSchedule).Should(Equal(schedule))
Expect(hco.Status.DataImportSchedule).Should(Equal(schedule))
Expect(req.StatusDirty).Should(BeFalse())
Expect(dataImportSchedule).To(Equal(schedule))
Expect(hco.Status.DataImportSchedule).To(Equal(schedule))
Expect(req.StatusDirty).To(BeFalse())
})

It("should update the variable if it different than the status", func() {
Expand All @@ -80,8 +80,8 @@ var _ = Describe("test data import schedule", func() {

applyDataImportSchedule(req)

Expect(dataImportSchedule).Should(Equal(schedule))
Expect(hco.Status.DataImportSchedule).Should(Equal(schedule))
Expect(req.StatusDirty).Should(BeFalse())
Expect(dataImportSchedule).To(Equal(schedule))
Expect(hco.Status.DataImportSchedule).To(Equal(schedule))
Expect(req.StatusDirty).To(BeFalse())
})
})
Loading