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
85ecc65e
Commit
85ecc65e
authored
May 14, 2010
by
Pieter Noordhuis
Browse files
initial rough integration test for replication
parent
1c4114be
Changes
3
Hide whitespace changes
Inline
Side-by-side
tests/integration/replication.tcl
0 → 100644
View file @
85ecc65e
start_server default.conf
{}
{
r set mykey foo
start_server default.conf
{}
{
test
{
Second server should have role master at first
}
{
s role
}
{
master
}
test
{
SLAVEOF should start with link status
"down"
}
{
r slaveof
[
srv -1 host
]
[
srv -1 port
]
s master_link_status
}
{
down
}
test
{
The role should immediately be changed to
"slave"
}
{
s role
}
{
slave
}
wait_for_sync r
test
{
Sync should have transferred keys from master
}
{
r get mykey
}
{
foo
}
test
{
The link status should be up
}
{
s master_link_status
}
{
up
}
test
{
SET on the master should immediately propagate
}
{
r -1 set mykey bar
r 0 get mykey
}
{
bar
}
}
}
tests/support/util.tcl
View file @
85ecc65e
...
@@ -56,6 +56,16 @@ proc waitForBgrewriteaof r {
...
@@ -56,6 +56,16 @@ proc waitForBgrewriteaof r {
}
}
}
}
proc wait_for_sync r
{
while 1
{
if
{[
status r master_link_status
]
eq
"down"
}
{
after 10
}
else
{
break
}
}
}
proc randomInt
{
max
}
{
proc randomInt
{
max
}
{
expr
{
int
(
rand
()
*$max
)}
expr
{
int
(
rand
()
*$max
)}
}
}
...
...
tests/test_helper.tcl
View file @
85ecc65e
...
@@ -60,6 +60,7 @@ proc main {} {
...
@@ -60,6 +60,7 @@ proc main {} {
execute_tests
"unit/sort"
execute_tests
"unit/sort"
execute_tests
"unit/expire"
execute_tests
"unit/expire"
execute_tests
"unit/other"
execute_tests
"unit/other"
execute_tests
"integration/replication"
puts
"
\n
[
expr $::passed+$::failed
]
tests,
$::passed
passed,
$::failed
failed"
puts
"
\n
[
expr $::passed+$::failed
]
tests,
$::passed
passed,
$::failed
failed"
if
{
$::failed
> 0
}
{
if
{
$::failed
> 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