From e8e6969fdadbbfdee75222e94a3c2ebdd37efc99 Mon Sep 17 00:00:00 2001 From: Paul Lorenz Date: Tue, 2 Mar 2021 15:49:20 -0500 Subject: [PATCH] Fix flaky test caused by loss of time resolution --- tests/context.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/context.go b/tests/context.go index 064a6b6d2..fb85092bb 100644 --- a/tests/context.go +++ b/tests/context.go @@ -629,7 +629,9 @@ func (ctx *TestContext) getEntityDates(jsonEntity *gabs.Container) (time.Time, t } func (ctx *TestContext) validateDateFieldsForUpdate(start time.Time, origCreatedAt time.Time, jsonEntity *gabs.Container) time.Time { - now := time.Now() + // we lose a little time resolution, so if it's in the same millisecond, it's ok + start = start.Add(-time.Millisecond) + now := time.Now().Add(time.Millisecond) createdAt, updatedAt := ctx.getEntityDates(jsonEntity) ctx.Req.Equal(origCreatedAt, createdAt)