Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
64c2508e
Unverified
Commit
64c2508e
authored
Nov 21, 2019
by
Salvatore Sanfilippo
Committed by
GitHub
Nov 21, 2019
Browse files
Merge branch 'unstable' into rm_get_server_info
parents
04233097
f1f259de
Changes
44
Hide whitespace changes
Inline
Side-by-side
tests/unit/moduleapi/misc.tcl
View file @
64c2508e
...
...
@@ -16,4 +16,55 @@ start_server {tags {"modules"}} {
assert
{
[
string match
"*cmdstat_module*"
$info
]
}
}
test
{
test long double conversions
}
{
set ld
[
r test.ld_conversion
]
assert
{[
string match $ld
"0.00000000000000001"
]}
}
test
{
test module db commands
}
{
r set x foo
set key
[
r test.randomkey
]
assert_equal $key
"x"
assert_equal
[
r test.dbsize
]
1
r test.flushall
assert_equal
[
r test.dbsize
]
0
}
test
{
test modle lru api
}
{
r config set maxmemory-policy allkeys-lru
r set x foo
set lru
[
r test.getlru x
]
assert
{
$lru <= 1000
}
set was_set
[
r test.setlru x 100000
]
assert
{
$was_set == 1
}
set idle
[
r object idletime x
]
assert
{
$idle >= 100
}
set lru
[
r test.getlru x
]
assert
{
$lru >= 100000
}
r config set maxmemory-policy allkeys-lfu
set lru
[
r test.getlru x
]
assert
{
$lru == -1
}
set was_set
[
r test.setlru x 100000
]
assert
{
$was_set == 0
}
}
r config set maxmemory-policy allkeys-lru
test
{
test modle lfu api
}
{
r config set maxmemory-policy allkeys-lfu
r set x foo
set lfu
[
r test.getlfu x
]
assert
{
$lfu >= 1
}
set was_set
[
r test.setlfu x 100
]
assert
{
$was_set == 1
}
set freq
[
r object freq x
]
assert
{
$freq <= 100
}
set lfu
[
r test.getlfu x
]
assert
{
$lfu <= 100
}
r config set maxmemory-policy allkeys-lru
set lfu
[
r test.getlfu x
]
assert
{
$lfu == -1
}
set was_set
[
r test.setlfu x 100
]
assert
{
$was_set == 0
}
}
}
tests/unit/moduleapi/scan.tcl
0 → 100644
View file @
64c2508e
set testmodule
[
file normalize tests/modules/scan.so
]
start_server
{
tags
{
"modules"
}}
{
r module load $testmodule
test
{
Module scan keyspace
}
{
# the module create a scan command with filtering which also return values
r set x 1
r set y 2
r set z 3
r hset h f v
lsort
[
r scan.scan_strings
]
}
{{
x 1
}
{
y 2
}
{
z 3
}}
test
{
Module scan hash ziplist
}
{
r hmset hh f1 v1 f2 v2
lsort
[
r scan.scan_key hh
]
}
{{
f1 v1
}
{
f2 v2
}}
test
{
Module scan hash dict
}
{
r config set hash-max-ziplist-entries 2
r hmset hh f3 v3
lsort
[
r scan.scan_key hh
]
}
{{
f1 v1
}
{
f2 v2
}
{
f3 v3
}}
test
{
Module scan zset ziplist
}
{
r zadd zz 1 f1 2 f2
lsort
[
r scan.scan_key zz
]
}
{{
f1 1
}
{
f2 2
}}
test
{
Module scan zset dict
}
{
r config set zset-max-ziplist-entries 2
r zadd zz 3 f3
lsort
[
r scan.scan_key zz
]
}
{{
f1 1
}
{
f2 2
}
{
f3 3
}}
test
{
Module scan set intset
}
{
r sadd ss 1 2
lsort
[
r scan.scan_key ss
]
}
{{
1
{}}
{
2
{}}}
test
{
Module scan set dict
}
{
r config set set-max-intset-entries 2
r sadd ss 3
lsort
[
r scan.scan_key ss
]
}
{{
1
{}}
{
2
{}}
{
3
{}}}
}
tests/unit/scripting.tcl
View file @
64c2508e
...
...
@@ -536,7 +536,7 @@ foreach cmdrepl {0 1} {
start_server
{
tags
{
"scripting repl"
}}
{
start_server
{}
{
if
{
$cmdrepl
== 1
}
{
set rt
"(comm
m
ands replication)"
set rt
"(commands replication)"
}
else
{
set rt
"(scripts replication)"
r debug lua-always-replicate-commands 1
...
...
tests/unit/type/stream.tcl
View file @
64c2508e
...
...
@@ -79,6 +79,12 @@ start_server {
assert
{[
streamCompareID $id2 $id3
]
== -1
}
}
test
{
XADD IDs correctly report an error when overflowing
}
{
r DEL mystream
r xadd mystream 18446744073709551615-18446744073709551615 a b
assert_error ERR*
{
r xadd mystream * c d
}
}
test
{
XADD with MAXLEN option
}
{
r DEL mystream
for
{
set j 0
}
{
$j
< 1000
}
{
incr j
}
{
...
...
@@ -117,6 +123,12 @@ start_server {
assert
{[
r xlen mystream
]
== $j
}
}
test
{
XADD with ID 0-0
}
{
r DEL otherstream
catch
{
r XADD otherstream 0-0 k v
}
err
assert
{[
r EXISTS otherstream
]
== 0
}
}
test
{
XRANGE COUNT works as expected
}
{
assert
{[
llength
[
r xrange mystream - + COUNT 10
]]
== 10
}
}
...
...
Prev
1
2
3
Next
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