diff options
Diffstat (limited to 'examples/redis-unstable/tests/unit/info-command.tcl')
| -rw-r--r-- | examples/redis-unstable/tests/unit/info-command.tcl | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/examples/redis-unstable/tests/unit/info-command.tcl b/examples/redis-unstable/tests/unit/info-command.tcl new file mode 100644 index 0000000..bc24ed2 --- /dev/null +++ b/examples/redis-unstable/tests/unit/info-command.tcl | |||
| @@ -0,0 +1,62 @@ | |||
| 1 | start_server {tags {"info and its relative command"}} { | ||
| 2 | test "info command with at most one sub command" { | ||
| 3 | foreach arg {"" "all" "default" "everything"} { | ||
| 4 | if {$arg == ""} { | ||
| 5 | set info [r 0 info] | ||
| 6 | } else { | ||
| 7 | set info [r 0 info $arg] | ||
| 8 | } | ||
| 9 | |||
| 10 | assert { [string match "*redis_version*" $info] } | ||
| 11 | assert { [string match "*used_cpu_user*" $info] } | ||
| 12 | assert { ![string match "*sentinel_tilt*" $info] } | ||
| 13 | assert { [string match "*used_memory*" $info] } | ||
| 14 | if {$arg == "" || $arg == "default"} { | ||
| 15 | assert { ![string match "*rejected_calls*" $info] } | ||
| 16 | } else { | ||
| 17 | assert { [string match "*rejected_calls*" $info] } | ||
| 18 | } | ||
| 19 | } | ||
| 20 | } | ||
| 21 | |||
| 22 | test "info command with one sub-section" { | ||
| 23 | set info [r info cpu] | ||
| 24 | assert { [string match "*used_cpu_user*" $info] } | ||
| 25 | assert { ![string match "*sentinel_tilt*" $info] } | ||
| 26 | assert { ![string match "*used_memory*" $info] } | ||
| 27 | |||
| 28 | set info [r info sentinel] | ||
| 29 | assert { ![string match "*sentinel_tilt*" $info] } | ||
| 30 | assert { ![string match "*used_memory*" $info] } | ||
| 31 | |||
| 32 | set info [r info commandSTATS] ;# test case insensitive compare | ||
| 33 | assert { ![string match "*used_memory*" $info] } | ||
| 34 | assert { [string match "*rejected_calls*" $info] } | ||
| 35 | } | ||
| 36 | |||
| 37 | test "info command with multiple sub-sections" { | ||
| 38 | set info [r info cpu sentinel] | ||
| 39 | assert { [string match "*used_cpu_user*" $info] } | ||
| 40 | assert { ![string match "*sentinel_tilt*" $info] } | ||
| 41 | assert { ![string match "*master_repl_offset*" $info] } | ||
| 42 | |||
| 43 | set info [r info cpu all] | ||
| 44 | assert { [string match "*used_cpu_user*" $info] } | ||
| 45 | assert { ![string match "*sentinel_tilt*" $info] } | ||
| 46 | assert { [string match "*used_memory*" $info] } | ||
| 47 | assert { [string match "*master_repl_offset*" $info] } | ||
| 48 | assert { [string match "*rejected_calls*" $info] } | ||
| 49 | # check that we didn't get the same info twice | ||
| 50 | assert { ![string match "*used_cpu_user_children*used_cpu_user_children*" $info] } | ||
| 51 | |||
| 52 | set info [r info cpu default] | ||
| 53 | assert { [string match "*used_cpu_user*" $info] } | ||
| 54 | assert { ![string match "*sentinel_tilt*" $info] } | ||
| 55 | assert { [string match "*used_memory*" $info] } | ||
| 56 | assert { [string match "*master_repl_offset*" $info] } | ||
| 57 | assert { ![string match "*rejected_calls*" $info] } | ||
| 58 | # check that we didn't get the same info twice | ||
| 59 | assert { ![string match "*used_cpu_user_children*used_cpu_user_children*" $info] } | ||
| 60 | } | ||
| 61 | |||
| 62 | } | ||
