diff options
author | antirez <antirez@gmail.com> | 2017-09-29 16:17:46 +0200 |
---|---|---|
committer | antirez <antirez@gmail.com> | 2017-12-01 10:24:24 +0100 |
commit | e53c90308b2940fa548a26583099e7a640d7abc9 (patch) | |
tree | 3bd4e824747b4fe8f34b31964965382f53e3975d /tests | |
parent | 0248a6b125df10ab74de3db82bc348cc4a6dce63 (diff) | |
download | redis-e53c90308b2940fa548a26583099e7a640d7abc9.tar.gz |
Streams: add XADD + MAXLEN test.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/unit/type/stream.tcl | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/unit/type/stream.tcl b/tests/unit/type/stream.tcl index c63ed8a25..e9f187ae2 100644 --- a/tests/unit/type/stream.tcl +++ b/tests/unit/type/stream.tcl @@ -79,6 +79,23 @@ start_server { assert {[streamCompareID $id2 $id3] == -1} } + test {XADD with MAXLEN option} { + r DEL mystream + for {set j 0} {$j < 1000} {incr j} { + if {rand() < 0.9} { + r XADD mystream MAXLEN 5 * xitem $j + } else { + r XADD mystream MAXLEN 5 * yitem $j + } + } + set res [r xrange mystream - +] + set expected 995 + foreach r $res { + assert {[lindex $r 1 1] == $expected} + incr expected + } + } + test {XADD mass insertion and XLEN} { r DEL mystream r multi |