Add missing pause tcl test to test_helper.tcl (#9158)

* Add keyname tags to avoid CROSSSLOT errors in external server CI
* Use new wait_for_blocked_clients_count in pause.tcl
This commit is contained in:
Binbin 2021-06-30 18:32:51 +08:00 committed by GitHub
parent 4278c45c91
commit 5dddf496ce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 24 additions and 55 deletions

View File

@ -70,6 +70,7 @@ set ::all_tests {
unit/hyperloglog
unit/lazyfree
unit/wait
unit/pause
unit/querybuf
unit/pendingquerybuf
unit/tls

View File

@ -15,11 +15,7 @@ start_server {tags {"pause network"}} {
set rd [redis_deferring_client]
$rd SET FOO BAR
wait_for_condition 50 100 {
[s 0 blocked_clients] eq {1}
} else {
fail "Clients are not blocked"
}
wait_for_blocked_clients_count 1 50 100
r client unpause
assert_match "OK" [$rd read]
@ -33,30 +29,18 @@ start_server {tags {"pause network"}} {
# Test that pfcount, which can replicate, is also blocked
set rd [redis_deferring_client]
$rd PFCOUNT pause-hll
wait_for_condition 50 100 {
[s 0 blocked_clients] eq {1}
} else {
fail "Clients are not blocked"
}
wait_for_blocked_clients_count 1 50 100
# Test that publish, which adds the message to the replication
# stream is blocked.
set rd2 [redis_deferring_client]
$rd2 publish foo bar
wait_for_condition 50 100 {
[s 0 blocked_clients] eq {2}
} else {
fail "Clients are not blocked"
}
wait_for_blocked_clients_count 2 50 100
# Test that SCRIPT LOAD, which is replicated.
set rd3 [redis_deferring_client]
$rd3 script load "return 1"
wait_for_condition 50 100 {
[s 0 blocked_clients] eq {3}
} else {
fail "Clients are not blocked"
}
wait_for_blocked_clients_count 3 50 100
r client unpause
assert_match "1" [$rd read]
@ -92,11 +76,7 @@ start_server {tags {"pause network"}} {
r client PAUSE 100000000 WRITE
assert_equal [$rd read] "QUEUED"
$rd EXEC
wait_for_condition 50 100 {
[s 0 blocked_clients] eq {1}
} else {
fail "Clients are not blocked"
}
wait_for_blocked_clients_count 1 50 100
r client unpause
assert_match "OK" [$rd read]
$rd close
@ -106,12 +86,8 @@ start_server {tags {"pause network"}} {
r client PAUSE 100000000 WRITE
set rd [redis_deferring_client]
$rd EVAL "return 1" 0
wait_for_condition 50 100 {
[s 0 blocked_clients] eq {1}
} else {
fail "Clients are not blocked"
}
wait_for_blocked_clients_count 1 50 100
r client unpause
assert_match "1" [$rd read]
$rd close
@ -123,12 +99,8 @@ start_server {tags {"pause network"}} {
foreach client $clients {
$client SET FOO BAR
}
wait_for_condition 50 100 {
[s 0 blocked_clients] eq {3}
} else {
fail "Clients are not blocked"
}
wait_for_blocked_clients_count 3 50 100
r client unpause
foreach client $clients {
assert_match "OK" [$client read]
@ -143,16 +115,16 @@ start_server {tags {"pause network"}} {
r client unpause
}
test "Test both active and passive expiries are skipped during client pause" {
test "Test both active and passive expires are skipped during client pause" {
set expired_keys [s 0 expired_keys]
r multi
r set foo bar PX 10
r set bar foo PX 10
r set foo{t} bar{t} PX 10
r set bar{t} foo{t} PX 10
r client PAUSE 100000000 WRITE
r exec
wait_for_condition 10 100 {
[r get foo] == {} && [r get bar] == {}
[r get foo{t}] == {} && [r get bar{t}] == {}
} else {
fail "Keys were never logically expired"
}
@ -163,8 +135,8 @@ start_server {tags {"pause network"}} {
r client unpause
# Force the keys to expire
r get foo
r get bar
r get foo{t}
r get bar{t}
# Now that clients have been unpaused, expires should go through
assert_match [expr $expired_keys + 2] [s 0 expired_keys]
@ -172,23 +144,19 @@ start_server {tags {"pause network"}} {
test "Test that client pause starts at the end of a transaction" {
r MULTI
r SET FOO1 BAR
r SET FOO1{t} BAR
r client PAUSE 100000000 WRITE
r SET FOO2 BAR
r SET FOO2{t} BAR
r exec
set rd [redis_deferring_client]
$rd SET FOO3 BAR
wait_for_condition 50 100 {
[s 0 blocked_clients] eq {1}
} else {
fail "Clients are not blocked"
}
$rd SET FOO3{t} BAR
assert_match "BAR" [r GET FOO1]
assert_match "BAR" [r GET FOO2]
assert_match "" [r GET FOO3]
wait_for_blocked_clients_count 1 50 100
assert_match "BAR" [r GET FOO1{t}]
assert_match "BAR" [r GET FOO2{t}]
assert_match "" [r GET FOO3{t}]
r client unpause
assert_match "OK" [$rd read]