forked from redis/redis
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Redis Cluster test framework skeleton.
- Loading branch information
Showing
5 changed files
with
72 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/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 $* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Cluster-specific test functions. | ||
# | ||
# Copyright (C) 2014 Salvatore Sanfilippo [email protected] | ||
# This softare is released under the BSD License. See the COPYING file for | ||
# more information. | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Cluster test suite. Copyright (C) 2014 Salvatore Sanfilippo [email protected] | ||
# 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 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# 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}} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# 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 | ||
} | ||
} | ||
} | ||
} |