From efe4335faa3ac3085b2518088f07018113bdbca9 Mon Sep 17 00:00:00 2001 From: Stefan Bueringer Date: Tue, 7 Sep 2021 15:33:41 +0200 Subject: [PATCH] fix flaky TestPatchHelper tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Stefan Büringer buringerst@vmware.com --- util/patch/patch_test.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/util/patch/patch_test.go b/util/patch/patch_test.go index 1d968c0292fa..59fbafe13f61 100644 --- a/util/patch/patch_test.go +++ b/util/patch/patch_test.go @@ -425,6 +425,10 @@ func TestPatchHelper(t *testing.T) { readyBefore := conditions.Get(obj, clusterv1.ReadyCondition) readyAfter := conditions.Get(objAfter, clusterv1.ReadyCondition) + // Differences in the LastTransitionTime are intentionally ignored as the LastTransitionTime is re-calculated + // in conditions.Set during patch.Helper.Patch() and thus not necessarily equal to the one in the original obj. + readyBefore.LastTransitionTime = readyAfter.LastTransitionTime + return cmp.Equal(readyBefore, readyAfter) }, timeout).Should(BeTrue()) }) @@ -476,6 +480,10 @@ func TestPatchHelper(t *testing.T) { readyBefore := conditions.Get(obj, clusterv1.ReadyCondition) readyAfter := conditions.Get(objAfter, clusterv1.ReadyCondition) + // Differences in the LastTransitionTime are intentionally ignored as the LastTransitionTime is re-calculated + // in conditions.Set during patch.Helper.Patch() and thus not necessarily equal to the one in the original obj. + readyBefore.LastTransitionTime = readyAfter.LastTransitionTime + return cmp.Equal(readyBefore, readyAfter) }, timeout).Should(BeTrue()) })