Add 2 test cases for XDEL and XGROUP CREATE command (#11137)
This PR includes 2 missed test cases of XDEL and XGROUP CREATE command 1. one test case: XDEL delete multiply id once 2. 3 test cases: XGROUP CREATE has ENTRIESREAD parameter, which equal 0 (special positive number), 3 and negative value. Co-authored-by: Ubuntu <lucas.guang.yang1@huawei.com> Co-authored-by: Oran Agra <oran@redislabs.com> Co-authored-by: Binbin <binloveplay1314@qq.com>
This commit is contained in:
parent
3a16ad30b7
commit
c3a0253bc8
@ -9,6 +9,29 @@ start_server {
|
||||
set err
|
||||
} {BUSYGROUP*}
|
||||
|
||||
test {XGROUP CREATE: with ENTRIESREAD parameter} {
|
||||
r DEL mystream
|
||||
r XADD mystream 1-1 a 1
|
||||
r XADD mystream 1-2 b 2
|
||||
r XADD mystream 1-3 c 3
|
||||
r XADD mystream 1-4 d 4
|
||||
assert_error "*value for ENTRIESREAD must be positive or -1*" {r XGROUP CREATE mystream mygroup $ ENTRIESREAD -3}
|
||||
|
||||
r XGROUP CREATE mystream mygroup1 $ ENTRIESREAD 0
|
||||
r XGROUP CREATE mystream mygroup2 $ ENTRIESREAD 3
|
||||
|
||||
set reply [r xinfo groups mystream]
|
||||
foreach group_info $reply {
|
||||
set group_name [dict get $group_info name]
|
||||
set entries_read [dict get $group_info entries-read]
|
||||
if {$group_name == "mygroup1"} {
|
||||
assert_equal $entries_read 0
|
||||
} else {
|
||||
assert_equal $entries_read 3
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
test {XGROUP CREATE: automatic stream creation fails without MKSTREAM} {
|
||||
r DEL mystream
|
||||
catch {r XGROUP CREATE mystream mygroup $} err
|
||||
|
@ -469,6 +469,20 @@ start_server {
|
||||
assert {[lindex $result 1 1 1] eq {value2}}
|
||||
}
|
||||
|
||||
test {XDEL multiply id test} {
|
||||
r del somestream
|
||||
r xadd somestream 1-1 a 1
|
||||
r xadd somestream 1-2 b 2
|
||||
r xadd somestream 1-3 c 3
|
||||
r xadd somestream 1-4 d 4
|
||||
r xadd somestream 1-5 e 5
|
||||
assert {[r xlen somestream] == 5}
|
||||
assert {[r xdel somestream 1-1 1-4 1-5 2-1] == 3}
|
||||
assert {[r xlen somestream] == 2}
|
||||
set result [r xrange somestream - +]
|
||||
assert {[dict get [lindex $result 0 1] b] eq {2}}
|
||||
assert {[dict get [lindex $result 1 1] c] eq {3}}
|
||||
}
|
||||
# Here the idea is to check the consistency of the stream data structure
|
||||
# as we remove all the elements down to zero elements.
|
||||
test {XDEL fuzz test} {
|
||||
|
Loading…
x
Reference in New Issue
Block a user