summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2018-10-10 17:37:37 +0200
committerantirez <antirez@gmail.com>2018-10-15 13:05:17 +0200
commit80c471f58ec55b9d31aff07f00133e493912a9c8 (patch)
tree9a8ff1ef3c24552b6b89cfcce1231508dd3962e3 /tests
parent8defa5da3cd96c0f7ca7aedc5e16ffd3a60fed0d (diff)
downloadredis-80c471f58ec55b9d31aff07f00133e493912a9c8.tar.gz
Test: cgroup propagation test also for NOACK variant.
Related to #5433.
Diffstat (limited to 'tests')
-rw-r--r--tests/unit/type/stream-cgroups.tcl68
1 files changed, 39 insertions, 29 deletions
diff --git a/tests/unit/type/stream-cgroups.tcl b/tests/unit/type/stream-cgroups.tcl
index 34a724321..4df16c1a4 100644
--- a/tests/unit/type/stream-cgroups.tcl
+++ b/tests/unit/type/stream-cgroups.tcl
@@ -103,36 +103,46 @@ start_server {
set master_port [srv -1 port]
set slave [srv 0 client]
- test {Consumer group last ID propagation to slave} {
- $slave slaveof $master_host $master_port
- wait_for_condition 50 100 {
- [s 0 master_link_status] eq {up}
- } else {
- fail "Replication not started."
- }
-
- $master del stream
- $master xadd stream * a 1
- $master xadd stream * a 2
- $master xadd stream * a 3
- $master xgroup create stream mygroup 0
-
- # Consume the first two items on the master
- for {set j 0} {$j < 2} {incr j} {
- set item [$master xreadgroup group mygroup myconsumer COUNT 1 STREAMS stream >]
- set id [lindex $item 0 1 0 0]
- assert {[$master xack stream mygroup $id] eq "1"}
+ foreach noack {0 1} {
+ test "Consumer group last ID propagation to slave (NOACK=$noack)" {
+ $slave slaveof $master_host $master_port
+ wait_for_condition 50 100 {
+ [s 0 master_link_status] eq {up}
+ } else {
+ fail "Replication not started."
+ }
+
+ $master del stream
+ $master xadd stream * a 1
+ $master xadd stream * a 2
+ $master xadd stream * a 3
+ $master xgroup create stream mygroup 0
+
+ # Consume the first two items on the master
+ for {set j 0} {$j < 2} {incr j} {
+ if {$noack} {
+ set item [$master xreadgroup group mygroup \
+ myconsumer COUNT 1 NOACK STREAMS stream >]
+ } else {
+ set item [$master xreadgroup group mygroup \
+ myconsumer COUNT 1 STREAMS stream >]
+ }
+ set id [lindex $item 0 1 0 0]
+ if {$noack == 0} {
+ assert {[$master xack stream mygroup $id] eq "1"}
+ }
+ }
+
+ # Turn slave into master
+ $slave slaveof no one
+
+ set item [$slave xreadgroup group mygroup myconsumer \
+ COUNT 1 STREAMS stream >]
+
+ # The consumed enty should be the third
+ set myentry [lindex $item 0 1 0 1]
+ assert {$myentry eq {a 3}}
}
-
- # Turn slave into master
- $slave slaveof no one
- set master $slave
-
- set item [$master xreadgroup group mygroup myconsumer COUNT 1 STREAMS stream >]
-
- # The consumed enty should be the third
- set myentry [lindex $item 0 1 0 1]
- assert {$myentry eq {a 3}}
}
}
}