fix timestamp test such that it works in all timezones

This commit is contained in:
Marten Seemann
2017-07-15 11:23:42 +07:00
parent 5de4d3ccb5
commit 33260d91a2

View File

@@ -82,13 +82,13 @@ var _ = Describe("Log", func() {
}) })
It("adds a timestamp", func() { It("adds a timestamp", func() {
format := "Jan 2, 2006 at 3:04:05pm (MST)" format := "Jan 2, 2006"
SetLogTimeFormat(format) SetLogTimeFormat(format)
SetLogLevel(LogLevelInfo) SetLogLevel(LogLevelInfo)
Infof("info") Infof("info")
t, err := time.Parse(format, string(b.Bytes()[:b.Len()-6])) t, err := time.Parse(format, string(b.Bytes()[:b.Len()-6]))
Expect(err).ToNot(HaveOccurred()) Expect(err).ToNot(HaveOccurred())
Expect(t).To(BeTemporally("~", time.Now(), 2*time.Second)) Expect(t).To(BeTemporally("~", time.Now(), 25*time.Hour))
}) })
It("says whether debug is enabled", func() { It("says whether debug is enabled", func() {