1
0
mirror of https://github.com/redis/go-redis.git synced 2025-07-26 19:21:03 +03:00

Fix flaky tests by using better matcher.

This commit is contained in:
Vladimir Mihailenco
2015-06-03 15:09:56 +03:00
parent 7d886330f1
commit 3fc16811b5

View File

@ -369,8 +369,7 @@ var _ = Describe("Commands", func() {
pttl := client.PTTL("key") pttl := client.PTTL("key")
Expect(pttl.Err()).NotTo(HaveOccurred()) Expect(pttl.Err()).NotTo(HaveOccurred())
Expect(pttl.Val() <= expiration).To(Equal(true)) Expect(pttl.Val()).To(BeNumerically("~", expiration, 10*time.Millisecond))
Expect(pttl.Val() >= expiration-time.Millisecond).To(Equal(true))
}) })
It("should PExpireAt", func() { It("should PExpireAt", func() {
@ -389,8 +388,7 @@ var _ = Describe("Commands", func() {
pttl := client.PTTL("key") pttl := client.PTTL("key")
Expect(pttl.Err()).NotTo(HaveOccurred()) Expect(pttl.Err()).NotTo(HaveOccurred())
Expect(pttl.Val() <= expiration).To(Equal(true)) Expect(pttl.Val()).To(BeNumerically("~", expiration, 10*time.Millisecond))
Expect(pttl.Val() >= expiration-time.Millisecond).To(Equal(true))
}) })
It("should PTTL", func() { It("should PTTL", func() {
@ -405,8 +403,7 @@ var _ = Describe("Commands", func() {
pttl := client.PTTL("key") pttl := client.PTTL("key")
Expect(pttl.Err()).NotTo(HaveOccurred()) Expect(pttl.Err()).NotTo(HaveOccurred())
Expect(pttl.Val() <= expiration).To(Equal(true)) Expect(pttl.Val()).To(BeNumerically("~", expiration, 10*time.Millisecond))
Expect(pttl.Val() >= expiration-time.Millisecond).To(Equal(true))
}) })
It("should RandomKey", func() { It("should RandomKey", func() {