summaryrefslogtreecommitdiff
path: root/tests/integration/replication.tcl
diff options
context:
space:
mode:
authorFelipe Machado <462154+felipou@users.noreply.github.com>2020-10-08 02:33:17 -0300
committerGitHub <noreply@github.com>2020-10-08 08:33:17 +0300
commitc3f9e017946cffdc3e7166e96e9ff98484db7963 (patch)
tree129309ef8f31f466d2f3845308d9db042efb51f8 /tests/integration/replication.tcl
parent2127f7c8ebc1d8638eb0c99764f698cebcdb6513 (diff)
downloadredis-c3f9e017946cffdc3e7166e96e9ff98484db7963.tar.gz
Adds new pop-push commands (LMOVE, BLMOVE) (#6929)
Adding [B]LMOVE <src> <dst> RIGHT|LEFT RIGHT|LEFT. deprecating [B]RPOPLPUSH. Note that when receiving a BRPOPLPUSH we'll still propagate an RPOPLPUSH, but on BLMOVE RIGHT LEFT we'll propagate an LMOVE improvement to existing tests - Replace "after 1000" with "wait_for_condition" when wait for clients to block/unblock. - Add a pre-existing element to target list on basic tests so that we can check if the new element was added to the correct side of the list. - check command stats on the replica to make sure the right command was replicated Co-authored-by: Oran Agra <oran@redislabs.com>
Diffstat (limited to 'tests/integration/replication.tcl')
-rw-r--r--tests/integration/replication.tcl37
1 files changed, 37 insertions, 0 deletions
diff --git a/tests/integration/replication.tcl b/tests/integration/replication.tcl
index d2c8b8e56..06414dd8a 100644
--- a/tests/integration/replication.tcl
+++ b/tests/integration/replication.tcl
@@ -78,6 +78,7 @@ start_server {tags {"repl"}} {
}
test {BRPOPLPUSH replication, when blocking against empty list} {
+ $A config resetstat
set rd [redis_deferring_client]
$rd brpoplpush a b 5
r lpush a foo
@@ -86,9 +87,12 @@ start_server {tags {"repl"}} {
} else {
fail "Master and replica have different digest: [$A debug digest] VS [$B debug digest]"
}
+ assert_match {*calls=1,*} [cmdrstat rpoplpush $A]
+ assert_match {} [cmdrstat lmove $A]
}
test {BRPOPLPUSH replication, list exists} {
+ $A config resetstat
set rd [redis_deferring_client]
r lpush c 1
r lpush c 2
@@ -96,6 +100,39 @@ start_server {tags {"repl"}} {
$rd brpoplpush c d 5
after 1000
assert_equal [$A debug digest] [$B debug digest]
+ assert_match {*calls=1,*} [cmdrstat rpoplpush $A]
+ assert_match {} [cmdrstat lmove $A]
+ }
+
+ foreach wherefrom {left right} {
+ foreach whereto {left right} {
+ test "BLMOVE ($wherefrom, $whereto) replication, when blocking against empty list" {
+ $A config resetstat
+ set rd [redis_deferring_client]
+ $rd blmove a b $wherefrom $whereto 5
+ r lpush a foo
+ wait_for_condition 50 100 {
+ [$A debug digest] eq [$B debug digest]
+ } else {
+ fail "Master and replica have different digest: [$A debug digest] VS [$B debug digest]"
+ }
+ assert_match {*calls=1,*} [cmdrstat lmove $A]
+ assert_match {} [cmdrstat rpoplpush $A]
+ }
+
+ test "BLMOVE ($wherefrom, $whereto) replication, list exists" {
+ $A config resetstat
+ set rd [redis_deferring_client]
+ r lpush c 1
+ r lpush c 2
+ r lpush c 3
+ $rd blmove c d $wherefrom $whereto 5
+ after 1000
+ assert_equal [$A debug digest] [$B debug digest]
+ assert_match {*calls=1,*} [cmdrstat lmove $A]
+ assert_match {} [cmdrstat rpoplpush $A]
+ }
+ }
}
test {BLPOP followed by role change, issue #2473} {