From 321741146dee1d7f95fe4352a3f5081832db4d38 Mon Sep 17 00:00:00 2001 From: fabriziopandini Date: Wed, 11 Sep 2024 22:12:06 +0200 Subject: [PATCH] Fix test for running in CI --- util/conditions/v1beta2/getter_test.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/util/conditions/v1beta2/getter_test.go b/util/conditions/v1beta2/getter_test.go index 3853c46c62c4..1d7bc72ad49f 100644 --- a/util/conditions/v1beta2/getter_test.go +++ b/util/conditions/v1beta2/getter_test.go @@ -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) @@ -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) { @@ -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) { @@ -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) { @@ -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)) }) }