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
c7b74395
Commit
c7b74395
authored
Feb 18, 2014
by
antirez
Browse files
Sentinel test: basic tests for MONITOR and auto-discovery.
parent
c4fbc1d3
Changes
1
Hide whitespace changes
Inline
Side-by-side
tests/sentinel-tests/00-base.tcl
View file @
c7b74395
...
@@ -4,6 +4,29 @@ test "Sentinels aren't monitoring any master" {
...
@@ -4,6 +4,29 @@ test "Sentinels aren't monitoring any master" {
}
}
}
}
test
"
Sentinels can start monitoring a master
"
{
test
"
Create a master-slaves cluster of 3 instances
"
{
create_redis_master_slave_cluster 3
create_redis_master_slave_cluster 3
}
}
test
"Sentinels can start monitoring a master"
{
set sentinels
[
llength $::sentinel_instances
]
set quorum
[
expr
{
$sentinels
/2+1
}]
foreach_sentinel_id id
{
S $id SENTINEL MONITOR mymaster
[
get_instance_attrib redis 0 host
]
\
[
get_instance_attrib redis 0 port
]
$quorum
}
foreach_sentinel_id id
{
assert
{[
S $id sentinel master mymaster
]
ne
{}}
}
}
test
"Sentinels are able to auto-discover other sentinels"
{
set sentinels
[
llength $::sentinel_instances
]
foreach_sentinel_id id
{
wait_for_condition 100 50
{
[
dict get
[
S $id SENTINEL MASTER mymaster
]
num-other-sentinels
]
==
(
$sentinels-1
)
}
else
{
fail
"At least some sentinel can't detect some other sentinel"
}
}
}
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