diff options
author | Wen Hui <wen.hui.ware@gmail.com> | 2020-10-18 03:15:43 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-18 10:15:43 +0300 |
commit | f328194d12e06a748aac7a35b1dda179bfc6cb0f (patch) | |
tree | 0e7a8d1923858684a3d45b554b11a629e03fbf00 /tests/unit/type/stream.tcl | |
parent | f6010e106b47c7a72026a10edc6b9b7fb79c3f04 (diff) | |
download | redis-f328194d12e06a748aac7a35b1dda179bfc6cb0f.tar.gz |
support NOMKSTREAM option in xadd command (#7910)
introduces a NOMKSTREAM option for xadd command, this would be useful for some
use cases when we do not want to create new stream by default:
XADD key [MAXLEN [~|=] <count>] [NOMKSTREAM] <ID or *> [field value] [field value]
Diffstat (limited to 'tests/unit/type/stream.tcl')
-rw-r--r-- | tests/unit/type/stream.tcl | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/unit/type/stream.tcl b/tests/unit/type/stream.tcl index 0ff570cab..b02d6a0fb 100644 --- a/tests/unit/type/stream.tcl +++ b/tests/unit/type/stream.tcl @@ -102,6 +102,18 @@ start_server { } } + test {XADD with NOMKSTREAM option} { + r DEL mystream + assert_equal "" [r XADD mystream NOMKSTREAM * item 1 value a] + assert_equal 0 [r EXISTS mystream] + r XADD mystream * item 1 value a + r XADD mystream NOMKSTREAM * item 2 value b + assert_equal 2 [r XLEN mystream] + set items [r XRANGE mystream - +] + assert_equal [lindex $items 0 1] {item 1 value a} + assert_equal [lindex $items 1 1] {item 2 value b} + } + test {XADD mass insertion and XLEN} { r DEL mystream r multi |