summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorSalvatore Sanfilippo <antirez@gmail.com>2019-12-29 14:53:06 +0100
committerGitHub <noreply@github.com>2019-12-29 14:53:06 +0100
commit3ff95d9074a88d53c339260225beaf304d393c70 (patch)
treeb0acfedcd7e7c663de5646770598a82a5f4356ee /tests
parent1bae5dfff612287dccafeca25230970666bb262d (diff)
parent1f75ce30dfdb1c8c4df8474f9580f2aff032cfb4 (diff)
downloadredis-3ff95d9074a88d53c339260225beaf304d393c70.tar.gz
Merge pull request #6706 from guybe7/stream_id_edge_cases
Stream: Handle streamID-related edge cases
Diffstat (limited to 'tests')
-rw-r--r--tests/unit/type/stream.tcl27
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/unit/type/stream.tcl b/tests/unit/type/stream.tcl
index 656bac5de..9840e3b74 100644
--- a/tests/unit/type/stream.tcl
+++ b/tests/unit/type/stream.tcl
@@ -328,6 +328,33 @@ start_server {
assert_equal [r xrevrange teststream2 1234567891245 -] {{1234567891240-0 {key1 value2}} {1234567891230-0 {key1 value1}}}
}
+
+ test {XREAD streamID edge (no-blocking)} {
+ r del x
+ r XADD x 1-1 f v
+ r XADD x 1-18446744073709551615 f v
+ r XADD x 2-1 f v
+ set res [r XREAD BLOCK 0 STREAMS x 1-18446744073709551615]
+ assert {[lindex $res 0 1 0] == {2-1 {f v}}}
+ }
+
+ test {XREAD streamID edge (blocking)} {
+ r del x
+ set rd [redis_deferring_client]
+ $rd XREAD BLOCK 0 STREAMS x 1-18446744073709551615
+ r XADD x 1-1 f v
+ r XADD x 1-18446744073709551615 f v
+ r XADD x 2-1 f v
+ set res [$rd read]
+ assert {[lindex $res 0 1 0] == {2-1 {f v}}}
+ }
+
+ test {XADD streamID edge} {
+ r del x
+ r XADD x 2577343934890-18446744073709551615 f v ;# we need the timestamp to be in the future
+ r XADD x * f2 v2
+ assert_equal [r XRANGE x - +] {{2577343934890-18446744073709551615 {f v}} {2577343934891-0 {f2 v2}}}
+ }
}
start_server {tags {"stream"} overrides {appendonly yes}} {