Skip to content

Commit

Permalink
add new test with shell script, because original python test seems br…
Browse files Browse the repository at this point in the history
…oken (even at https://travis-ci.org/idning/twemproxy, only do build and install test).
  • Loading branch information
umegaya committed Oct 21, 2015
1 parent cb50953 commit dfba9f8
Show file tree
Hide file tree
Showing 9 changed files with 1,487 additions and 0 deletions.
716 changes: 716 additions & 0 deletions tests/test_redis_sh/conf/7379.conf

Large diffs are not rendered by default.

716 changes: 716 additions & 0 deletions tests/test_redis_sh/conf/7380.conf

Large diffs are not rendered by default.

10 changes: 10 additions & 0 deletions tests/test_redis_sh/conf/nutcracker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
default:
listen: 0.0.0.0:6379
hash: fnv1a_64
distribution: ketama
redis: true
server_retry_timeout: 2000
server_failure_limit: 1
servers:
- 127.0.0.1:7379:1 sv1
- 127.0.0.1:7380:1 sv2
Empty file.
Empty file.
10 changes: 10 additions & 0 deletions tests/test_redis_sh/run
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

source ./start_cluster.sh

bash $1
RET=$?

source ./stop_cluster.sh

exit $?
12 changes: 12 additions & 0 deletions tests/test_redis_sh/start_cluster.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash

REDIS=`which redis-server`
mkdir dir/7379
$REDIS ./conf/7379.conf
mkdir dir/7380
$REDIS ./conf/7380.conf

NC=`which nutcracker`
$NC -c ./conf/nutcracker.yml &

sleep 3
7 changes: 7 additions & 0 deletions tests/test_redis_sh/stop_cluster.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

killall redis-server
killall nutcracker
rm -rf dir/73*/*
rm -rf dir/logs/*.log
rm -rf dir/pid/*.pid
16 changes: 16 additions & 0 deletions tests/test_redis_sh/test_script_load.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash

redis-cli -p 7379 SET a x
RET=`redis-cli -p 7379 GET a`
[ "$RET" != "x" ] && echo "redis not running" && exit -1
RET=`redis-cli -p 7380 GET a`
[ "$RET" = "x" ] && echo "replica setting wrongly applied" && exit -1

SHA1=`redis-cli script load 'return "hello"'`
echo "SHA1:$SHA1"
RET=`redis-cli -p 7379 evalsha $SHA1 1 key`
[ "$RET" != "hello" ] && echo "script not correctly loaded at 7379" && exit -1
RET=`redis-cli -p 7380 evalsha $SHA1 1 key`
[ "$RET" != "hello" ] && echo "script not correctly loaded at 7380" && exit -1

echo "success"

0 comments on commit dfba9f8

Please sign in to comment.