Skip to content

Commit

Permalink
Unit test script for enabling event on downstream connection
Browse files Browse the repository at this point in the history
Change-Id: Id6329c5bb9cebed6d1231a8aff00dfd465e19e5a
Reviewed-on: http://review.couchbase.org/9744
Reviewed-by: Steve Yen <steve.yen@gmail.com>
Tested-by: Steve Yen <steve.yen@gmail.com>
  • Loading branch information
nimish gupta authored and steveyen committed Oct 29, 2011
1 parent a17b424 commit 1853268
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions t/issue-conn-close.sh
@@ -0,0 +1,36 @@
#!/bin/sh

echo starting moxi...

./moxi -d -P /tmp/moxi-conn-close-moxi.pid \
-z 11266=127.0.0.1:11277 -t 1 \
-Z downstream_conn_max=1,downstream_max=0,downstream_timeout=0,wait_queue_timeout=0,downstream_conn_queue_timeout=100,retry=0

echo starting memcached simulant...
./moxi -d -P /tmp/moxi-conn-close-memcached.pid -p 11277
sleep 2;

echo client request 1 - expect NOT_FOUND
echo incr a 1 | nc 127.0.0.1 11266

echo stopping memcached simulant...
kill -9 `cat /tmp/moxi-conn-close-memcached.pid`

echo starting again memcached simulant...
./moxi -d -p 11277
sleep 2

echo client request 2 - use up the one downstream conn. since that downstream connection is closed, \
and retry is zero, in the old moxi, it should have returned the downstream close error. But with the conn-close fix \
response will be NOT_FOUND.
out=`echo incr a 2 | nc 127.0.0.1 11266`

if [[ "$out" != NOT_FOUND* ]];then
echo "Test case failed"
else
echo "Test case passed"
fi

echo stopping moxi...
killall moxi

0 comments on commit 1853268

Please sign in to comment.