Skip to content

Commit 63f992c

Browse files
fix unit tests
1 parent caa2607 commit 63f992c

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

util/conditions/experimental/getter_test.go

+9-9
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ func TestGetAll(t *testing.T) {
152152
Status: builder.Phase0ObjStatus{
153153
Conditions: clusterv1.Conditions{
154154
{
155-
Type: "fooCondition",
155+
Type: "barCondition",
156156
Status: corev1.ConditionTrue,
157157
LastTransitionTime: now,
158158
},
@@ -184,14 +184,14 @@ func TestGetAll(t *testing.T) {
184184

185185
got, err := GetAll(foo)
186186
g.Expect(err).NotTo(HaveOccurred())
187-
g.Expect(got).To(Equal(expect), cmp.Diff(got, expect))
187+
g.Expect(got).To(MatchConditions(expect), cmp.Diff(got, expect))
188188

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

192192
got, err = GetAll(&unstructured.Unstructured{Object: fooUnstructured})
193193
g.Expect(err).NotTo(HaveOccurred())
194-
g.Expect(got).To(Equal(expect), cmp.Diff(got, expect))
194+
g.Expect(got).To(MatchConditions(expect), cmp.Diff(got, expect))
195195
})
196196

197197
t.Run("v1beta1 object with both legacy and experimental conditions", func(t *testing.T) {
@@ -231,14 +231,14 @@ func TestGetAll(t *testing.T) {
231231

232232
got, err := GetAll(foo)
233233
g.Expect(err).NotTo(HaveOccurred())
234-
g.Expect(got).To(Equal(expect), cmp.Diff(got, expect))
234+
g.Expect(got).To(MatchConditions(expect), cmp.Diff(got, expect))
235235

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

239239
got, err = GetAll(&unstructured.Unstructured{Object: fooUnstructured})
240240
g.Expect(err).NotTo(HaveOccurred())
241-
g.Expect(got).To(Equal(expect), cmp.Diff(got, expect))
241+
g.Expect(got).To(MatchConditions(expect), cmp.Diff(got, expect))
242242
})
243243

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

275275
got, err := GetAll(foo)
276276
g.Expect(err).NotTo(HaveOccurred())
277-
g.Expect(got).To(Equal(expect), cmp.Diff(got, expect))
277+
g.Expect(got).To(MatchConditions(expect), cmp.Diff(got, expect))
278278

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

282282
got, err = GetAll(&unstructured.Unstructured{Object: fooUnstructured})
283283
g.Expect(err).NotTo(HaveOccurred())
284-
g.Expect(got).To(Equal(expect), cmp.Diff(got, expect))
284+
g.Expect(got).To(MatchConditions(expect), cmp.Diff(got, expect))
285285
})
286286

287287
t.Run("v1beta2 object with conditions (end state)", func(t *testing.T) {
@@ -308,13 +308,13 @@ func TestGetAll(t *testing.T) {
308308

309309
got, err := GetAll(foo)
310310
g.Expect(err).NotTo(HaveOccurred())
311-
g.Expect(got).To(Equal(expect), cmp.Diff(got, expect))
311+
g.Expect(got).To(MatchConditions(expect), cmp.Diff(got, expect))
312312

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

316316
got, err = GetAll(&unstructured.Unstructured{Object: fooUnstructured})
317317
g.Expect(err).NotTo(HaveOccurred())
318-
g.Expect(got).To(Equal(expect), cmp.Diff(got, expect))
318+
g.Expect(got).To(MatchConditions(expect), cmp.Diff(got, expect))
319319
})
320320
}

util/conditions/experimental/setter_test.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ func TestSetAll(t *testing.T) {
183183

184184
got, err := GetAll(fooFromUnstructured)
185185
g.Expect(err).NotTo(HaveOccurred())
186-
g.Expect(got).To(Equal(conditions), cmp.Diff(got, conditions))
186+
g.Expect(got).To(MatchConditions(conditions), cmp.Diff(got, conditions))
187187
})
188188

189189
t.Run("v1beta2 object with conditions and backward compatible conditions", func(t *testing.T) {
@@ -206,7 +206,7 @@ func TestSetAll(t *testing.T) {
206206
conditions := cloneConditions()
207207
err := SetAll(foo, conditions)
208208
g.Expect(err).ToNot(HaveOccurred())
209-
g.Expect(foo.Status.Conditions).To(Equal(conditions), cmp.Diff(foo.Status.Conditions, conditions))
209+
g.Expect(foo.Status.Conditions).To(MatchConditions(conditions), cmp.Diff(foo.Status.Conditions, conditions))
210210
})
211211

212212
t.Run("v1beta2 object with conditions and backward compatible conditions / Unstructured", func(t *testing.T) {
@@ -240,7 +240,7 @@ func TestSetAll(t *testing.T) {
240240

241241
got, err := GetAll(fooFromUnstructured)
242242
g.Expect(err).NotTo(HaveOccurred())
243-
g.Expect(got).To(Equal(conditions), cmp.Diff(got, conditions))
243+
g.Expect(got).To(MatchConditions(conditions), cmp.Diff(got, conditions))
244244
})
245245

246246
t.Run("v1beta2 object with conditions (end state)", func(t *testing.T) {
@@ -279,6 +279,6 @@ func TestSetAll(t *testing.T) {
279279

280280
got, err := GetAll(fooFromUnstructured)
281281
g.Expect(err).NotTo(HaveOccurred())
282-
g.Expect(got).To(Equal(conditions), cmp.Diff(got, conditions))
282+
g.Expect(got).To(MatchConditions(conditions), cmp.Diff(got, conditions))
283283
})
284284
}

0 commit comments

Comments
 (0)