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
f115461f
Commit
f115461f
authored
Nov 18, 2016
by
antirez
Browse files
Test: WAIT tests added in wait.tcl unit.
parent
8fb3ad24
Changes
2
Hide whitespace changes
Inline
Side-by-side
tests/test_helper.tcl
View file @
f115461f
...
...
@@ -55,6 +55,7 @@ set ::all_tests {
unit/memefficiency
unit/hyperloglog
unit/lazyfree
unit/wait
}
# Index to the next test to run in the ::all_tests list.
set ::next_test 0
...
...
tests/unit/wait.tcl
0 → 100644
View file @
f115461f
start_server
{
tags
{
"wait"
}}
{
start_server
{}
{
set slave
[
srv 0 client
]
set slave_host
[
srv 0 host
]
set slave_port
[
srv 0 port
]
set master
[
srv -1 client
]
set master_host
[
srv -1 host
]
set master_port
[
srv -1 port
]
test
{
Setup slave
}
{
$slave slaveof $master_host $master_port
wait_for_condition 50 100
{
[
s 0 master_link_status
]
eq
{
up
}
}
else
{
fail
"Replication not started."
}
}
test
{
WAIT should acknowledge 1 additional copy of the data
}
{
$master set foo 0
$master incr foo
$master incr foo
$master incr foo
assert
{[
$master
wait 1 5000
]
== 1
}
assert
{[
$slave
get foo
]
== 3
}
}
test
{
WAIT should not acknowledge 2 additional copies of the data
}
{
$master incr foo
assert
{[
$master
wait 2 1000
]
<= 1
}
}
test
{
WAIT should not acknowledge 1 additional copy if slave is blocked
}
{
exec src/redis-cli -h $slave_host -p $slave_port debug sleep 5 > /dev/null 2> /dev/null &
after 1000
;
# Give redis-cli the time to execute the command.
$master set foo 0
$master incr foo
$master incr foo
$master incr foo
assert
{[
$master
wait 1 3000
]
== 0
}
}
}}
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