mirror of
https://github.com/redis/go-redis.git
synced 2025-04-19 07:22:17 +03:00
Added test case for CLIENT KILL with MAXAGE option (#2971)
* Added test case for CLIENT KILL with MAXAGE option * Fixed sleep value * Added additional condition to kill specific connection * Test commit * Test commit * Updated test case to handle timeouts --------- Co-authored-by: ofekshenawa <104765379+ofekshenawa@users.noreply.github.com>
This commit is contained in:
parent
a9b4c5cfe6
commit
0777247baa
@ -193,6 +193,40 @@ var _ = Describe("Commands", func() {
|
|||||||
Expect(r.Val()).To(Equal(int64(0)))
|
Expect(r.Val()).To(Equal(int64(0)))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
It("should ClientKillByFilter with MAXAGE", func() {
|
||||||
|
var s []string
|
||||||
|
started := make(chan bool)
|
||||||
|
done := make(chan bool)
|
||||||
|
|
||||||
|
go func() {
|
||||||
|
defer GinkgoRecover()
|
||||||
|
|
||||||
|
started <- true
|
||||||
|
blpop := client.BLPop(ctx, 0, "list")
|
||||||
|
Expect(blpop.Val()).To(Equal(s))
|
||||||
|
done <- true
|
||||||
|
}()
|
||||||
|
<-started
|
||||||
|
|
||||||
|
select {
|
||||||
|
case <-done:
|
||||||
|
Fail("BLPOP is not blocked.")
|
||||||
|
case <-time.After(2 * time.Second):
|
||||||
|
// ok
|
||||||
|
}
|
||||||
|
|
||||||
|
killed := client.ClientKillByFilter(ctx, "MAXAGE", "1")
|
||||||
|
Expect(killed.Err()).NotTo(HaveOccurred())
|
||||||
|
Expect(killed.Val()).To(Equal(int64(2)))
|
||||||
|
|
||||||
|
select {
|
||||||
|
case <-done:
|
||||||
|
// ok
|
||||||
|
case <-time.After(time.Second):
|
||||||
|
Fail("BLPOP is still blocked.")
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
It("should ClientID", func() {
|
It("should ClientID", func() {
|
||||||
err := client.ClientID(ctx).Err()
|
err := client.ClientID(ctx).Err()
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
|
Loading…
x
Reference in New Issue
Block a user