1 start_server
{tags
{"obuf-limits"}} {
2 test
{Client output buffer hard limit is enforced
} {
3 r config
set client-output-buffer-limit
{pubsub
100000 0 0}
4 set rd1
[redis_deferring_client
]
8 assert
{$reply eq
"subscribe foo 1"}
13 set clients
[split [r client
list] "\r\n"]
14 set c
[split [lindex $clients 1] " "]
15 if {![regexp {omem
=([0-9]+)} $c - omem
]} break
16 if {$omem > 200000} break
18 assert
{$omem >= 99970 && $omem < 200000}
22 test
{Client output buffer soft limit is not enforced
if time is not overreached
} {
23 r config
set client-output-buffer-limit
{pubsub
0 100000 10}
24 set rd1
[redis_deferring_client
]
28 assert
{$reply eq
"subscribe foo 1"}
35 set clients
[split [r client
list] "\r\n"]
36 set c
[split [lindex $clients 1] " "]
37 if {![regexp {omem
=([0-9]+)} $c - omem
]} break
39 if {$start_time == 0} {set start_time
[clock seconds
]}
40 set time_elapsed
[expr {[clock seconds
]-$start_time}]
41 if {$time_elapsed >= 5} break
44 assert
{$omem >= 100000 && $time_elapsed >= 5 && $time_elapsed <= 10}
48 test
{Client output buffer soft limit is enforced
if time is overreached
} {
49 r config
set client-output-buffer-limit
{pubsub
0 100000 3}
50 set rd1
[redis_deferring_client
]
54 assert
{$reply eq
"subscribe foo 1"}
61 set clients
[split [r client
list] "\r\n"]
62 set c
[split [lindex $clients 1] " "]
63 if {![regexp {omem
=([0-9]+)} $c - omem
]} break
65 if {$start_time == 0} {set start_time
[clock seconds
]}
66 set time_elapsed
[expr {[clock seconds
]-$start_time}]
67 if {$time_elapsed >= 10} break
70 assert
{$omem >= 100000 && $time_elapsed < 6}