Skip to content

Commit

Permalink
Fix get rocksdb ops tcl test case (apache#668)
Browse files Browse the repository at this point in the history
  • Loading branch information
caipengbo authored and jackwener committed Jul 1, 2022
1 parent 3db64b8 commit 70135ed
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions tests/tcl/tests/unit/command.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -43,26 +43,24 @@ start_server {tags {"command"}} {
}

test {get rocksdb ops by COMMAND INFO} {
# Write data for 5 seconds to ensure accurate and stable QPS.
for {set i 0} {$i < 25} {incr i} {
for {set j 0} {$j < 100} {incr j} {
for {set i 0} {$i < 2} {incr i} {
for {set j 0} {$j < 500} {incr j} {
r lpush key$i value$i
r lrange key$i 0 1
}
after 200
after 1000
}
set cmd_qps [s instantaneous_ops_per_sec]

set put_qps [s put_per_sec]
set get_qps [s get_per_sec]
set seek_qps [s seek_per_sec]
set next_qps [s next_per_sec]
# Based on the encoding of list, we can calculate the relationship
# between Rocksdb QPS and Command QPS.
assert {[expr abs($cmd_qps - $put_qps)] < 10}
assert {[expr abs($cmd_qps - $get_qps)] < 10}
assert {[expr abs($cmd_qps/2 - $seek_qps)] < 10}

assert {$put_qps > 0}
assert {$get_qps > 0}
assert {$seek_qps > 0}
# prev_per_sec is almost the same as next_per_sec
assert {[expr abs($cmd_qps - $next_qps)] < 10}
assert {$next_qps > 0}
}

test {get bgsave information from INFO command} {
Expand Down

0 comments on commit 70135ed

Please sign in to comment.