Skip to content

Commit

Permalink
adjust test case
Browse files Browse the repository at this point in the history
  • Loading branch information
soloestoy committed Feb 18, 2024
1 parent d033a1f commit 5d8d065
Showing 1 changed file with 3 additions and 16 deletions.
19 changes: 3 additions & 16 deletions tests/unit/info.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -418,8 +418,9 @@ start_server {tags {"info" "external:skip"}} {
$r2 watch key
assert_equal [s watching_clients] 1
assert_equal [s total_watched_keys] 1
assert_match {*watch=0*} [r client info]
assert_match {*watch=1*} [$r2 client info]
# different watch different key
# different client watch different key
r watch key2
assert_equal [s watching_clients] 2
assert_equal [s total_watched_keys] 2
Expand All @@ -436,44 +437,30 @@ start_server {tags {"info" "external:skip"}} {
assert_equal [s total_watched_keys] 0
assert_match {*watch=0*} [r client info]
assert_match {*watch=0*} [$r2 client info]

# count after watch/multi/exec
$r2 watch key
assert_equal [s watching_clients] 1
assert_equal [s total_watched_keys] 1
assert_match {*watch=1*} [$r2 client info]
$r2 multi
$r2 exec
assert_equal [s watching_clients] 0
assert_equal [s total_watched_keys] 0
assert_match {*watch=0*} [$r2 client info]
# count after watch/multi/discard
$r2 watch key
assert_equal [s watching_clients] 1
assert_equal [s total_watched_keys] 1
assert_match {*watch=1*} [$r2 client info]
$r2 multi
$r2 discard
assert_equal [s watching_clients] 0
assert_equal [s total_watched_keys] 0
assert_match {*watch=0*} [$r2 client info]
# discard without multi has no effect
$r2 watch key
assert_equal [s watching_clients] 1
assert_equal [s total_watched_keys] 1
assert_match {*watch=1*} [$r2 client info]
catch {$r2 discard} e
assert_equal [s watching_clients] 1
assert_equal [s total_watched_keys] 1
assert_match {*watch=1*} [$r2 client info]
# unwatch without watch has no effect
r unwatch
assert_equal [s watching_clients] 1
assert_equal [s total_watched_keys] 1
assert_match {*watch=1*} [$r2 client info]
# after disconnect
$r2 close
assert_equal [s watching_clients] 0
assert_equal [s total_watched_keys] 0
}
}
}

0 comments on commit 5d8d065

Please sign in to comment.