Permalink
Browse files

Unit test script for enabling event on downstream connection

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...
1 parent a17b424 commit 18532687ca5576e38023ed885c844e0e348906cd nimish gupta committed with steveyen Sep 24, 2011
Showing with 36 additions and 0 deletions.
  1. +36 −0 t/issue-conn-close.sh
View
@@ -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.