Fix flaky test caused by loss of time resolution

This commit is contained in:
Paul Lorenz
2021-03-02 15:49:20 -05:00
parent eaae599412
commit e8e6969fda
+3 -1
View File
@@ -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)