Skip to content

Commit

Permalink
Preperation to ginkgolinter: Expect.Should => Expect.To
Browse files Browse the repository at this point in the history
Signed-off-by: Nahshon Unna-Tsameret <[email protected]>
  • Loading branch information
nunnatsa committed Mar 18, 2024
1 parent 9907207 commit ad0c88a
Show file tree
Hide file tree
Showing 41 changed files with 1,255 additions and 1,255 deletions.
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

0 comments on commit ad0c88a

Please sign in to comment.