diff options
author | Oran Agra <oran@redislabs.com> | 2021-08-05 22:57:05 +0300 |
---|---|---|
committer | Oran Agra <oran@redislabs.com> | 2021-10-04 13:59:40 +0300 |
commit | aba95175426de624bf1b604a1139e754b982495d (patch) | |
tree | d9f71f1c15a91b41323bd9c183cd161647c6f180 | |
parent | 7540708a61764eeeabfa2bad3eb0fb2af2f78408 (diff) | |
download | redis-aba95175426de624bf1b604a1139e754b982495d.tar.gz |
corrupt-dump-fuzzer test, avoid creating junk keys (#9302)
The execution of the RPOPLPUSH command by the fuzzer created junk keys,
that were later being selected by RANDOMKEY and modified.
This also meant that lists were statistically tested more than other
files.
Fix the fuzzer not to pass junk key names to RPOPLPUSH, and add a check
that detects that new keys are not added by the fuzzer to detect future
similar issues.
(cherry picked from commit 3f3f678a4741e6af18230ee1862d9ced7af79faf)
-rw-r--r-- | tests/integration/corrupt-dump-fuzzer.tcl | 7 | ||||
-rw-r--r-- | tests/support/util.tcl | 3 |
2 files changed, 9 insertions, 1 deletions
diff --git a/tests/integration/corrupt-dump-fuzzer.tcl b/tests/integration/corrupt-dump-fuzzer.tcl index 1c3da9531..86cd8121b 100644 --- a/tests/integration/corrupt-dump-fuzzer.tcl +++ b/tests/integration/corrupt-dump-fuzzer.tcl @@ -90,6 +90,7 @@ foreach sanitize_dump {no yes} { r debug set-skip-checksum-validation 1 set start_time [clock seconds] generate_types + set dbsize [r dbsize] r save set cycle 0 set stat_terminated_in_restore 0 @@ -133,6 +134,12 @@ foreach sanitize_dump {no yes} { set sent [generate_fuzzy_traffic_on_key "_$k" 1] ;# traffic for 1 second incr stat_traffic_commands_sent [llength $sent] r del "_$k" ;# in case the server terminated, here's where we'll detect it. + if {$dbsize != [r dbsize]} { + puts "unexpected keys" + puts "keys: [r keys *]" + puts $sent + exit 1 + } } err ] } { # if the server terminated update stats and restart it set report_and_restart true diff --git a/tests/support/util.tcl b/tests/support/util.tcl index d6717f6e1..1d098b543 100644 --- a/tests/support/util.tcl +++ b/tests/support/util.tcl @@ -608,6 +608,7 @@ proc generate_fuzzy_traffic_on_key {key duration} { set arity [lindex $cmd_info 1] set arity [expr $arity < 0 ? - $arity: $arity] set firstkey [lindex $cmd_info 3] + set lastkey [lindex $cmd_info 4] set i 1 if {$cmd == "XINFO"} { lappend cmd "STREAM" @@ -637,7 +638,7 @@ proc generate_fuzzy_traffic_on_key {key duration} { incr i 4 } for {} {$i < $arity} {incr i} { - if {$i == $firstkey} { + if {$i == $firstkey || $i == $lastkey} { lappend cmd $key } else { lappend cmd [randomValue] |