2019-07-24 05:58:15 -04:00
|
|
|
set testmodule [file normalize tests/modules/infotest.so]
|
|
|
|
|
|
|
|
# Return value for INFO property
|
|
|
|
proc field {info property} {
|
|
|
|
if {[regexp "\r\n$property:(.*?)\r\n" $info _ value]} {
|
|
|
|
set _ $value
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
start_server {tags {"modules"}} {
|
|
|
|
r module load $testmodule log-key 0
|
|
|
|
|
|
|
|
test {module info all} {
|
|
|
|
set info [r info all]
|
|
|
|
# info all does not contain modules
|
|
|
|
assert { ![string match "*Spanish*" $info] }
|
2019-09-30 13:47:35 -04:00
|
|
|
assert { ![string match "*infotest_*" $info] }
|
2019-07-24 05:58:15 -04:00
|
|
|
assert { [string match "*used_memory*" $info] }
|
|
|
|
}
|
|
|
|
|
|
|
|
test {module info everything} {
|
|
|
|
set info [r info everything]
|
|
|
|
# info everything contains all default sections, but not ones for crash report
|
2019-08-18 03:01:57 -04:00
|
|
|
assert { [string match "*infotest_global*" $info] }
|
2019-07-24 05:58:15 -04:00
|
|
|
assert { [string match "*Spanish*" $info] }
|
|
|
|
assert { [string match "*Italian*" $info] }
|
|
|
|
assert { [string match "*used_memory*" $info] }
|
|
|
|
assert { ![string match "*Klingon*" $info] }
|
|
|
|
field $info infotest_dos
|
|
|
|
} {2}
|
|
|
|
|
|
|
|
test {module info modules} {
|
|
|
|
set info [r info modules]
|
|
|
|
# info all does not contain modules
|
|
|
|
assert { [string match "*Spanish*" $info] }
|
2019-08-18 03:01:57 -04:00
|
|
|
assert { [string match "*infotest_global*" $info] }
|
2019-07-24 05:58:15 -04:00
|
|
|
assert { ![string match "*used_memory*" $info] }
|
|
|
|
}
|
|
|
|
|
|
|
|
test {module info one module} {
|
|
|
|
set info [r info INFOTEST]
|
|
|
|
# info all does not contain modules
|
|
|
|
assert { [string match "*Spanish*" $info] }
|
|
|
|
assert { ![string match "*used_memory*" $info] }
|
2019-08-18 03:01:57 -04:00
|
|
|
field $info infotest_global
|
|
|
|
} {-2}
|
2019-07-24 05:58:15 -04:00
|
|
|
|
|
|
|
test {module info one section} {
|
|
|
|
set info [r info INFOTEST_SPANISH]
|
|
|
|
assert { ![string match "*used_memory*" $info] }
|
|
|
|
assert { ![string match "*Italian*" $info] }
|
2019-08-18 03:01:57 -04:00
|
|
|
assert { ![string match "*infotest_global*" $info] }
|
2019-07-24 05:58:15 -04:00
|
|
|
field $info infotest_uno
|
|
|
|
} {one}
|
|
|
|
|
2019-08-18 02:41:45 -04:00
|
|
|
test {module info dict} {
|
|
|
|
set info [r info infotest_keyspace]
|
|
|
|
set keyspace [field $info infotest_db0]
|
|
|
|
set keys [scan [regexp -inline {keys\=([\d]*)} $keyspace] keys=%d]
|
|
|
|
} {3}
|
2019-07-24 05:58:15 -04:00
|
|
|
|
2019-08-18 02:41:45 -04:00
|
|
|
# TODO: test crash report.
|
2019-07-24 05:58:15 -04:00
|
|
|
}
|