Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
6455274d
Commit
6455274d
authored
Oct 09, 2018
by
zhaozhao.zz
Committed by
antirez
Oct 17, 2018
Browse files
Streams: add tests for XSTREAM command
parent
0edbe953
Changes
1
Hide whitespace changes
Inline
Side-by-side
tests/unit/type/stream.tcl
View file @
6455274d
...
@@ -363,3 +363,42 @@ start_server {tags {"stream"} overrides {appendonly yes stream-node-max-entries
...
@@ -363,3 +363,42 @@ start_server {tags {"stream"} overrides {appendonly yes stream-node-max-entries
assert
{[
r xlen mystream
]
== 90
}
assert
{[
r xlen mystream
]
== 90
}
}
}
}
}
start_server
{
tags
{
"xstream command"
}}
{
test
{
XSTREAM can CREATE an empty stream
}
{
r XSTREAM CREATE mystream *
assert
{[
dict get
[
r xinfo stream mystream
]
length
]
== 0
}
}
test
{
XSTREAM cannot CREATE on an busy stream
}
{
catch
{
r XSTREAM CREATE mystream *
}
err
set _ $err
}
{
BUSY*
}
test
{
XSTREAM can CREATE an empty stream with specific ID
}
{
r del mystream
r XSTREAM CREATE mystream
"100-100"
assert
{[
dict get
[
r xinfo stream mystream
]
length
]
== 0
}
assert
{[
dict get
[
r xinfo stream mystream
]
last-generated-id
]
==
"100-100"
}
}
test
{
XSTREAM can SETID with $
}
{
r XSTREAM SETID mystream $
assert
{[
dict get
[
r xinfo stream mystream
]
last-generated-id
]
==
"100-100"
}
}
test
{
XSTREAM can SETID with specific ID
}
{
r XSTREAM SETID mystream
"200-0"
assert
{[
dict get
[
r xinfo stream mystream
]
last-generated-id
]
==
"200-0"
}
}
test
{
XSTREAM cannot SETID with smaller ID
}
{
catch
{
r XSTREAM SETID mystream
"0-0"
}
err
set _ $err
}
{
ERR*smaller*
}
test
{
XSTREAM cannot SETID on non-existent key
}
{
catch
{
r XSTREAM SETID stream $
}
err
set _ $err
}
{
ERR no such key
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment