Skip to content

Commit

Permalink
Fix test for running in CI
Browse files Browse the repository at this point in the history
  • Loading branch information
fabriziopandini committed Sep 11, 2024
1 parent c88ea62 commit 3217411
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions util/conditions/v1beta2/getter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ func (f *ObjWithWrongV1beta2ConditionType) DeepCopyObject() runtime.Object {
}

func TestGetAll(t *testing.T) {
now := metav1.Now().Rfc3339Copy()
now := metav1.Time{Time: metav1.Now().Rfc3339Copy().UTC()}

t.Run("fails with nil", func(t *testing.T) {
g := NewWithT(t)
Expand Down Expand Up @@ -174,7 +174,7 @@ func TestGetAll(t *testing.T) {

got, err = GetAll(&unstructured.Unstructured{Object: fooUnstructured})
g.Expect(err).NotTo(HaveOccurred())
g.Expect(got).To(MatchConditions(expect), cmp.Diff(got, expect))
g.Expect(got).To(MatchConditions(expect, IgnoreLastTransitionTime(true)), cmp.Diff(got, expect))
})

t.Run("v1beta1 object with both legacy and v1beta2 conditions", func(t *testing.T) {
Expand Down Expand Up @@ -216,14 +216,14 @@ func TestGetAll(t *testing.T) {

got, err := GetAll(foo)
g.Expect(err).NotTo(HaveOccurred())
g.Expect(got).To(MatchConditions(expect), cmp.Diff(got, expect))
g.Expect(got).To(MatchConditions(expect, IgnoreLastTransitionTime(true)), cmp.Diff(got, expect))

fooUnstructured, err := runtime.DefaultUnstructuredConverter.ToUnstructured(foo)
g.Expect(err).NotTo(HaveOccurred())

got, err = GetAll(&unstructured.Unstructured{Object: fooUnstructured})
g.Expect(err).NotTo(HaveOccurred())
g.Expect(got).To(MatchConditions(expect), cmp.Diff(got, expect))
g.Expect(got).To(MatchConditions(expect, IgnoreLastTransitionTime(true)), cmp.Diff(got, expect))
})

t.Run("v1beta2 object with conditions and backward compatible conditions", func(t *testing.T) {
Expand Down Expand Up @@ -263,14 +263,14 @@ func TestGetAll(t *testing.T) {

got, err := GetAll(foo)
g.Expect(err).NotTo(HaveOccurred())
g.Expect(got).To(MatchConditions(expect), cmp.Diff(got, expect))
g.Expect(got).To(MatchConditions(expect, IgnoreLastTransitionTime(true)), cmp.Diff(got, expect))

fooUnstructured, err := runtime.DefaultUnstructuredConverter.ToUnstructured(foo)
g.Expect(err).NotTo(HaveOccurred())

got, err = GetAll(&unstructured.Unstructured{Object: fooUnstructured})
g.Expect(err).NotTo(HaveOccurred())
g.Expect(got).To(MatchConditions(expect), cmp.Diff(got, expect))
g.Expect(got).To(MatchConditions(expect, IgnoreLastTransitionTime(true)), cmp.Diff(got, expect))
})

t.Run("v1beta2 object with conditions (end state)", func(t *testing.T) {
Expand Down Expand Up @@ -299,14 +299,14 @@ func TestGetAll(t *testing.T) {

got, err := GetAll(foo)
g.Expect(err).NotTo(HaveOccurred())
g.Expect(got).To(MatchConditions(expect), cmp.Diff(got, expect))
g.Expect(got).To(MatchConditions(expect, IgnoreLastTransitionTime(true)), cmp.Diff(got, expect))

fooUnstructured, err := runtime.DefaultUnstructuredConverter.ToUnstructured(foo)
g.Expect(err).NotTo(HaveOccurred())

got, err = GetAll(&unstructured.Unstructured{Object: fooUnstructured})
g.Expect(err).NotTo(HaveOccurred())
g.Expect(got).To(MatchConditions(expect), cmp.Diff(got, expect))
g.Expect(got).To(MatchConditions(expect, IgnoreLastTransitionTime(true)), cmp.Diff(got, expect))
})
}

Expand Down

0 comments on commit 3217411

Please sign in to comment.