Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
fbfd61b4
Commit
fbfd61b4
authored
Oct 10, 2018
by
antirez
Browse files
Test: cgroup propagation test also for NOACK variant.
Related to #5433.
parent
cfad5e45
Changes
1
Hide whitespace changes
Inline
Side-by-side
tests/unit/type/stream-cgroups.tcl
View file @
fbfd61b4
...
...
@@ -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
}}
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment