summary refs log tree commit homepage
path: root/t
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2011-01-19 18:07:13 -0800
committerEric Wong <normalperson@yhbt.net>2011-01-19 18:07:13 -0800
commitfc355db99bdbe72644e4691a7a107b6a29c77be6 (patch)
tree4cac8ca3af4f63729ad96fd79372f514b7b2656f /t
parentd59ea817d624478176212f27bb79976c371a9c6f (diff)
chunked Transfer-Encoding is only valid for HTTP/1.1
Diffstat (limited to 't')
-rwxr-xr-xt/t0202-async-response-one-oh.sh56
1 files changed, 56 insertions, 0 deletions
diff --git a/t/t0202-async-response-one-oh.sh b/t/t0202-async-response-one-oh.sh
new file mode 100755
index 0000000..0d833ca
--- /dev/null
+++ b/t/t0202-async-response-one-oh.sh
@@ -0,0 +1,56 @@
+#!/bin/sh
+CONFIG_RU=${CONFIG_RU-'async-response.ru'}
+. ./test-lib.sh
+
+skip_models Base WriterThreadPool WriterThreadSpawn
+
+t_plan 6 "async HTTP/1.0 response for $model"
+
+t_begin "setup and start" && {
+        rainbows_setup
+        rtmpfiles a b c a_err b_err c_err
+        # can't load Rack::Lint here since it'll cause Rev to slurp
+        rainbows -E none -D $CONFIG_RU -c $unicorn_config
+        rainbows_wait_start
+}
+
+t_begin "send async requests off in parallel" && {
+        t0=$(date +%s)
+        curl="curl -0 --no-buffer -vsSf http://$listen/"
+        ( $curl 2>> $a_err | utee $a) &
+        ( $curl 2>> $b_err | utee $b) &
+        ( $curl 2>> $c_err | utee $c) &
+        wait
+        t1=$(date +%s)
+}
+
+t_begin "ensure elapsed requests were processed in parallel" && {
+        elapsed=$(( $t1 - $t0 ))
+        echo "elapsed=$elapsed < 30"
+        test $elapsed -lt 30
+}
+
+t_begin "termination signal sent" && {
+        kill $rainbows_pid
+}
+
+dbgcat a
+dbgcat b
+dbgcat c
+dbgcat a_err
+
+t_begin "no errors from curl" && {
+        if grep -i Transfer-Encoding $a_err $b_err $c_err
+        then
+                die "Unexpected Transfer-Encoding: header"
+        fi
+        for i in $a_err $b_err $c_err
+        do
+                grep 'Connection: close' $i
+        done
+}
+
+dbgcat r_err
+t_begin "no errors in stderr" && check_stderr
+
+t_done