mirror of
https://github.com/redis/go-redis.git
synced 2025-07-28 06:42:00 +03:00
Fix WithContext and add tests
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
package redis_test
|
||||
|
||||
import (
|
||||
"context"
|
||||
"crypto/rand"
|
||||
"fmt"
|
||||
"net"
|
||||
@ -41,6 +42,14 @@ var _ = Describe("Redis Ring", func() {
|
||||
Expect(ring.Close()).NotTo(HaveOccurred())
|
||||
})
|
||||
|
||||
It("supports WithContext", func() {
|
||||
c, cancel := context.WithCancel(context.Background())
|
||||
cancel()
|
||||
|
||||
err := ring.WithContext(c).Ping().Err()
|
||||
Expect(err).To(MatchError("context canceled"))
|
||||
})
|
||||
|
||||
It("distributes keys", func() {
|
||||
setRingKeys()
|
||||
|
||||
|
Reference in New Issue
Block a user