Skip to content

Commit 3217411

Browse files
Fix test for running in CI
1 parent c88ea62 commit 3217411

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

util/conditions/v1beta2/getter_test.go

+8-8
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ func (f *ObjWithWrongV1beta2ConditionType) DeepCopyObject() runtime.Object {
7878
}
7979

8080
func TestGetAll(t *testing.T) {
81-
now := metav1.Now().Rfc3339Copy()
81+
now := metav1.Time{Time: metav1.Now().Rfc3339Copy().UTC()}
8282

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

175175
got, err = GetAll(&unstructured.Unstructured{Object: fooUnstructured})
176176
g.Expect(err).NotTo(HaveOccurred())
177-
g.Expect(got).To(MatchConditions(expect), cmp.Diff(got, expect))
177+
g.Expect(got).To(MatchConditions(expect, IgnoreLastTransitionTime(true)), cmp.Diff(got, expect))
178178
})
179179

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

217217
got, err := GetAll(foo)
218218
g.Expect(err).NotTo(HaveOccurred())
219-
g.Expect(got).To(MatchConditions(expect), cmp.Diff(got, expect))
219+
g.Expect(got).To(MatchConditions(expect, IgnoreLastTransitionTime(true)), cmp.Diff(got, expect))
220220

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

224224
got, err = GetAll(&unstructured.Unstructured{Object: fooUnstructured})
225225
g.Expect(err).NotTo(HaveOccurred())
226-
g.Expect(got).To(MatchConditions(expect), cmp.Diff(got, expect))
226+
g.Expect(got).To(MatchConditions(expect, IgnoreLastTransitionTime(true)), cmp.Diff(got, expect))
227227
})
228228

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

264264
got, err := GetAll(foo)
265265
g.Expect(err).NotTo(HaveOccurred())
266-
g.Expect(got).To(MatchConditions(expect), cmp.Diff(got, expect))
266+
g.Expect(got).To(MatchConditions(expect, IgnoreLastTransitionTime(true)), cmp.Diff(got, expect))
267267

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

271271
got, err = GetAll(&unstructured.Unstructured{Object: fooUnstructured})
272272
g.Expect(err).NotTo(HaveOccurred())
273-
g.Expect(got).To(MatchConditions(expect), cmp.Diff(got, expect))
273+
g.Expect(got).To(MatchConditions(expect, IgnoreLastTransitionTime(true)), cmp.Diff(got, expect))
274274
})
275275

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

300300
got, err := GetAll(foo)
301301
g.Expect(err).NotTo(HaveOccurred())
302-
g.Expect(got).To(MatchConditions(expect), cmp.Diff(got, expect))
302+
g.Expect(got).To(MatchConditions(expect, IgnoreLastTransitionTime(true)), cmp.Diff(got, expect))
303303

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

307307
got, err = GetAll(&unstructured.Unstructured{Object: fooUnstructured})
308308
g.Expect(err).NotTo(HaveOccurred())
309-
g.Expect(got).To(MatchConditions(expect), cmp.Diff(got, expect))
309+
g.Expect(got).To(MatchConditions(expect, IgnoreLastTransitionTime(true)), cmp.Diff(got, expect))
310310
})
311311
}
312312

0 commit comments

Comments
 (0)