mirror of https://github.com/go-redis/redis.git
test: add test case for setting and scanning durations
This commit is contained in:
parent
2f1b74e20c
commit
a2a463b123
|
@ -300,6 +300,18 @@ var _ = Describe("Client", func() {
|
||||||
Expect(tm2).To(BeTemporally("==", tm))
|
Expect(tm2).To(BeTemporally("==", tm))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
It("should set and scan durations", func() {
|
||||||
|
duration := 10 * time.Minute
|
||||||
|
err := client.Set(ctx, "duration", duration, 0).Err()
|
||||||
|
Expect(err).NotTo(HaveOccurred())
|
||||||
|
|
||||||
|
var duration2 time.Duration
|
||||||
|
err = client.Get(ctx, "duration").Scan(&duration2)
|
||||||
|
Expect(err).NotTo(HaveOccurred())
|
||||||
|
|
||||||
|
Expect(duration2).To(Equal(duration))
|
||||||
|
})
|
||||||
|
|
||||||
It("should Conn", func() {
|
It("should Conn", func() {
|
||||||
err := client.Conn(ctx).Get(ctx, "this-key-does-not-exist").Err()
|
err := client.Conn(ctx).Get(ctx, "this-key-does-not-exist").Err()
|
||||||
Expect(err).To(Equal(redis.Nil))
|
Expect(err).To(Equal(redis.Nil))
|
||||||
|
|
Loading…
Reference in New Issue