summaryrefslogtreecommitdiff
path: root/tests/unit/type/stream.tcl
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2018-07-13 17:58:17 +0200
committerantirez <antirez@gmail.com>2018-07-13 17:58:17 +0200
commit2352a519928aa693d73d03c67898577a3bb2f56d (patch)
tree7d0f53b21ca2cace3c3e2cf16b41ffe2164f8c3a /tests/unit/type/stream.tcl
parent3d7d20b7f3fa186a6fd13f28a1382138b1b1b732 (diff)
downloadredis-2352a519928aa693d73d03c67898577a3bb2f56d.tar.gz
Test: XDEL fuzz testing. Remove and check stage.
Diffstat (limited to 'tests/unit/type/stream.tcl')
-rw-r--r--tests/unit/type/stream.tcl15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/unit/type/stream.tcl b/tests/unit/type/stream.tcl
index cf37ad38f..5cf6805d7 100644
--- a/tests/unit/type/stream.tcl
+++ b/tests/unit/type/stream.tcl
@@ -264,6 +264,21 @@ start_server {
# to report the right number of elements with XRANGE: this will also
# force accessing the whole data structure to check sanity.
assert {[r xlen somestream] == $x}
+
+ # We want to remove elements in random order to really test the
+ # implementation in a better way.
+ set ids [lshuffle $ids]
+ foreach id $ids {
+ assert {[r xdel somestream $id] == 1}
+ incr x -1
+ assert {[r xlen somestream] == $x}
+ # The test would be too slow calling XRANGE for every iteration.
+ # Do it every 100 removal.
+ if {$x % 100 == 0} {
+ set res [r xrange somestream - +]
+ assert {[llength $res] == $x}
+ }
+ }
}
test {XRANGE fuzzing} {