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
c3f85c01
Commit
c3f85c01
authored
Apr 24, 2014
by
antirez
Browse files
Redis Cluster test framework skeleton.
parent
7d9b45b4
Changes
5
Hide whitespace changes
Inline
Side-by-side
runtest-cluster
0 → 100755
View file @
c3f85c01
#!/bin/sh
TCL_VERSIONS
=
"8.5 8.6"
TCLSH
=
""
for
VERSION
in
$TCL_VERSIONS
;
do
TCL
=
`
which tclsh
$VERSION
2>/dev/null
`
&&
TCLSH
=
$TCL
done
if
[
-z
$TCLSH
]
then
echo
"You need tcl 8.5 or newer in order to run the Redis Sentinel test"
exit
1
fi
$TCLSH
tests/cluster/run.tcl
$*
tests/cluster/cluster.tcl
0 → 100644
View file @
c3f85c01
# Cluster-specific test functions.
#
# Copyright
(
C
)
2014 Salvatore Sanfilippo antirez@gmail.com
# This softare is released under the BSD License. See the COPYING file for
# more information.
tests/cluster/run.tcl
0 → 100644
View file @
c3f85c01
# Cluster test suite. Copyright
(
C
)
2014 Salvatore Sanfilippo antirez@gmail.com
# This softare is released under the BSD License. See the COPYING file for
# more information.
cd tests/cluster
source cluster.tcl
source ../instances.tcl
proc main
{}
{
parse_options
spawn_instance redis $::redis_base_port $::instances_count
{
"cluster-enabled yes"
"appendonly yes"
}
run_tests
cleanup
}
if
{[
catch main e
]}
{
puts $::errorInfo
cleanup
}
tests/cluster/tests/00-base.tcl
0 → 100644
View file @
c3f85c01
# Check the basic monitoring and failover capabilities.
source
"../tests/includes/init-tests.tcl"
if
{
$::simulate
_error
}
{
test
"This test will fail"
{
fail
"Simulated error"
}
}
test
"Cluster nodes are reachable."
{
foreach_redis_id id
{
# Every node should just know itself.
assert
{[
R $id ping
]
eq
{
PONG
}}
}
}
tests/cluster/tests/includes/init-tests.tcl
0 → 100644
View file @
c3f85c01
# Initialization tests -- most units will start including this.
test
"(init) Restart killed instances"
{
foreach type
{
redis
}
{
foreach_$
{
type
}
_id id
{
if
{[
get_instance_attrib $type $id pid
]
== -1
}
{
puts -nonewline
"
$type
/
$id
"
flush stdout
restart_instance $type $id
}
}
}
}
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