From 0790ff69373366a536bb183b2d1646d14af63594 Mon Sep 17 00:00:00 2001 From: Jinzhu Date: Thu, 9 Jul 2020 09:42:27 +0800 Subject: [PATCH] Update tests helper to check time --- utils/tests/utils.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/tests/utils.go b/utils/tests/utils.go index a44eb548..0067d5c6 100644 --- a/utils/tests/utils.go +++ b/utils/tests/utils.go @@ -27,7 +27,7 @@ func AssertEqual(t *testing.T, got, expect interface{}) { if curTime, ok := got.(time.Time); ok { format := "2006-01-02T15:04:05Z07:00" - if curTime.Round(time.Second).Format(format) != expect.(time.Time).Round(time.Second).Format(format) && curTime.Truncate(time.Second).Format(format) != expect.(time.Time).Truncate(time.Second).Format(format) { + if curTime.Round(time.Second).UTC().Format(format) != expect.(time.Time).Round(time.Second).UTC().Format(format) && curTime.Truncate(time.Second).UTC().Format(format) != expect.(time.Time).Truncate(time.Second).UTC().Format(format) { t.Errorf("%v: expect: %v, got %v after time round", utils.FileWithLineNum(), expect.(time.Time), curTime) } } else if fmt.Sprint(got) != fmt.Sprint(expect) {