Fix new obuf-limits tests to work with TLS (#7848)
Also stabilize new shutdown tests on slow machines (valgrind)
This commit is contained in:
parent
a295770e32
commit
8aa083bd28
@ -99,6 +99,8 @@ start_server {tags {"obuf-limits"}} {
|
|||||||
assert_equal {} [read $fd]
|
assert_equal {} [read $fd]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Note: This test assumes that what's written with one write, will be read by redis in one read.
|
||||||
|
# this assumption is wrong, but seem to work empirically (for now)
|
||||||
test {No response for multi commands in pipeline if client output buffer limit is enforced} {
|
test {No response for multi commands in pipeline if client output buffer limit is enforced} {
|
||||||
r config set client-output-buffer-limit {normal 100000 0 0}
|
r config set client-output-buffer-limit {normal 100000 0 0}
|
||||||
set value [string repeat "x" 10000]
|
set value [string repeat "x" 10000]
|
||||||
@ -107,20 +109,26 @@ start_server {tags {"obuf-limits"}} {
|
|||||||
set rd2 [redis_deferring_client]
|
set rd2 [redis_deferring_client]
|
||||||
$rd2 client setname multicommands
|
$rd2 client setname multicommands
|
||||||
assert_equal "OK" [$rd2 read]
|
assert_equal "OK" [$rd2 read]
|
||||||
# Let redis sleep 2s firstly
|
|
||||||
$rd1 debug sleep 2
|
# Let redis sleep 1s firstly
|
||||||
|
$rd1 debug sleep 1
|
||||||
$rd1 flush
|
$rd1 flush
|
||||||
after 100
|
after 100
|
||||||
|
|
||||||
|
# Create a pipeline of commands that will be processed in one socket read.
|
||||||
|
# It is important to use one write, in TLS mode independant writes seem
|
||||||
|
# to wait for response from the server.
|
||||||
# Total size should be less than OS socket buffer, redis can
|
# Total size should be less than OS socket buffer, redis can
|
||||||
# execute all commands in this pipeline when it wakes up.
|
# execute all commands in this pipeline when it wakes up.
|
||||||
|
set buf ""
|
||||||
for {set i 0} {$i < 15} {incr i} {
|
for {set i 0} {$i < 15} {incr i} {
|
||||||
$rd2 set $i $i
|
append buf "set $i $i\r\n"
|
||||||
$rd2 get $i
|
append buf "get $i\r\n"
|
||||||
$rd2 del $i
|
append buf "del $i\r\n"
|
||||||
# One bigkey is 10k, total response size must be more than 100k
|
# One bigkey is 10k, total response size must be more than 100k
|
||||||
$rd2 get bigkey
|
append buf "get bigkey\r\n"
|
||||||
}
|
}
|
||||||
|
$rd2 write $buf
|
||||||
$rd2 flush
|
$rd2 flush
|
||||||
after 100
|
after 100
|
||||||
|
|
||||||
|
@ -30,20 +30,28 @@ start_server {tags {"shutdown"}} {
|
|||||||
for {set i 0} {$i < 20} {incr i} {
|
for {set i 0} {$i < 20} {incr i} {
|
||||||
r set $i $i
|
r set $i $i
|
||||||
}
|
}
|
||||||
# It will cost 2s(20 * 100ms) to dump rdb
|
# It will cost 2s (20 * 100ms) to dump rdb
|
||||||
r config set rdb-key-save-delay 100000
|
r config set rdb-key-save-delay 100000
|
||||||
|
|
||||||
set pid [s process_id]
|
set pid [s process_id]
|
||||||
set temp_rdb [file join [lindex [r config get dir] 1] temp-${pid}.rdb]
|
set temp_rdb [file join [lindex [r config get dir] 1] temp-${pid}.rdb]
|
||||||
|
|
||||||
|
# trigger a shutdown which will save an rdb
|
||||||
exec kill -SIGINT $pid
|
exec kill -SIGINT $pid
|
||||||
after 100
|
# Wait for creation of temp rdb
|
||||||
# Temp rdb must be existed
|
wait_for_condition 50 10 {
|
||||||
assert {[file exists $temp_rdb]}
|
[file exists $temp_rdb]
|
||||||
|
} else {
|
||||||
|
fail "Can't trigger rdb save on shutdown"
|
||||||
|
}
|
||||||
|
|
||||||
# Temp rdb file must be deleted
|
# Insist on immediate shutdown, temp rdb file must be deleted
|
||||||
exec kill -SIGINT $pid
|
exec kill -SIGINT $pid
|
||||||
after 100
|
# wait for the rdb file to be deleted
|
||||||
assert {![file exists $temp_rdb]}
|
wait_for_condition 50 10 {
|
||||||
|
![file exists $temp_rdb]
|
||||||
|
} else {
|
||||||
|
fail "Can't trigger rdb save on shutdown"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user