Fix new obuf-limits tests to work with TLS (#7848)

Also stabilize new shutdown tests on slow machines (valgrind)
This commit is contained in:
Oran Agra 2020-09-27 17:13:33 +03:00 committed by GitHub
parent a295770e32
commit 8aa083bd28
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 29 additions and 13 deletions

View File

@ -99,6 +99,8 @@ start_server {tags {"obuf-limits"}} {
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} {
r config set client-output-buffer-limit {normal 100000 0 0}
set value [string repeat "x" 10000]
@ -107,20 +109,26 @@ start_server {tags {"obuf-limits"}} {
set rd2 [redis_deferring_client]
$rd2 client setname multicommands
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
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
# execute all commands in this pipeline when it wakes up.
set buf ""
for {set i 0} {$i < 15} {incr i} {
$rd2 set $i $i
$rd2 get $i
$rd2 del $i
append buf "set $i $i\r\n"
append buf "get $i\r\n"
append buf "del $i\r\n"
# 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
after 100

View File

@ -30,20 +30,28 @@ start_server {tags {"shutdown"}} {
for {set i 0} {$i < 20} {incr 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
set pid [s process_id]
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
after 100
# Temp rdb must be existed
assert {[file exists $temp_rdb]}
# Wait for creation of temp rdb
wait_for_condition 50 10 {
[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
after 100
assert {![file exists $temp_rdb]}
# wait for the rdb file to be deleted
wait_for_condition 50 10 {
![file exists $temp_rdb]
} else {
fail "Can't trigger rdb save on shutdown"
}
}
}