From d2741ae51eddfe927c503626d435b4a3444996fc Mon Sep 17 00:00:00 2001 From: Jinzhu Date: Sat, 30 May 2020 14:29:05 +0800 Subject: [PATCH] Fix test failed due to time round --- tests/utils.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/utils.go b/tests/utils.go index 001d77e9..92163d5c 100644 --- a/tests/utils.go +++ b/tests/utils.go @@ -86,8 +86,8 @@ func AssertEqual(t *testing.T, got, expect interface{}) { if curTime, ok := got.(time.Time); ok { format := "2006-01-02T15:04:05Z07:00" - if curTime.Format(format) != expect.(time.Time).Format(format) { - t.Errorf("%v: expect: %v, got %v", utils.FileWithLineNum(), expect.(time.Time).Format(format), curTime.Format(format)) + if curTime.Round(time.Second).Format(format) != expect.(time.Time).Round(time.Second).Format(format) { + t.Errorf("%v: expect: %v, got %v", utils.FileWithLineNum(), expect.(time.Time).Round(time.Second).Format(format), curTime.Round(time.Second).Format(format)) } } else if got != expect { t.Errorf("%v: expect: %#v, got %#v", utils.FileWithLineNum(), expect, got)