about summary refs log tree commit homepage
path: root/t
diff options
context:
space:
mode:
Diffstat (limited to 't')
-rwxr-xr-xt/t0106-rack-input-keepalive.sh72
-rw-r--r--t/test_isolate.rb2
2 files changed, 73 insertions, 1 deletions
diff --git a/t/t0106-rack-input-keepalive.sh b/t/t0106-rack-input-keepalive.sh
new file mode 100755
index 0000000..c4a531d
--- /dev/null
+++ b/t/t0106-rack-input-keepalive.sh
@@ -0,0 +1,72 @@
+#!/bin/sh
+. ./test-lib.sh
+t_plan 7 "rack.input pipelining test"
+
+t_begin "setup and startup" && {
+        rainbows_setup $model
+        rtmpfiles req
+        rainbows -D sha1.ru -c $unicorn_config
+        body=hello
+        body_size=$(printf $body | wc -c)
+        body_sha1=$(printf $body | rsha1)
+        rainbows_wait_start
+}
+
+t_begin "send pipelined identity requests" && {
+
+        {
+                printf 'PUT / HTTP/1.0\r\n'
+                printf 'Connection: keep-alive\r\n'
+                printf 'Content-Length: %d\r\n\r\n%s' $body_size $body
+                printf 'PUT / HTTP/1.1\r\nHost: example.com\r\n'
+                printf 'Content-Length: %d\r\n\r\n%s' $body_size $body
+                printf 'PUT / HTTP/1.0\r\n'
+                printf 'Content-Length: %d\r\n\r\n%s' $body_size $body
+        } > $req
+        (
+                cat $fifo > $tmp &
+                cat $req
+                wait
+                echo ok > $ok
+        ) | socat - TCP4:$listen > $fifo
+        test x"$(cat $ok)" = xok
+}
+
+t_begin "check responses" && {
+        dbgcat tmp
+        test 3 -eq $(grep $body_sha1 $tmp | wc -l)
+}
+
+t_begin "send pipelined chunked requests" && {
+
+        {
+                printf 'PUT / HTTP/1.0\r\n'
+                printf 'Connection: keep-alive\r\n'
+                printf 'Transfer-Encoding: chunked\r\n\r\n'
+                printf '%x\r\n%s\r\n0\r\n\r\n' $body_size $body
+                printf 'PUT / HTTP/1.1\r\nHost: example.com\r\n'
+                printf 'Transfer-Encoding: chunked\r\n\r\n'
+                printf '%x\r\n%s\r\n0\r\n\r\n' $body_size $body
+                printf 'PUT / HTTP/1.0\r\n'
+                printf 'Transfer-Encoding: chunked\r\n\r\n'
+                printf '%x\r\n%s\r\n0\r\n\r\n' $body_size $body
+        } > $req
+        (
+                cat $fifo > $tmp &
+                cat $req
+                wait
+                echo ok > $ok
+        ) | socat - TCP4:$listen > $fifo
+        test x"$(cat $ok)" = xok
+}
+
+t_begin "check responses" && {
+        dbgcat tmp
+        test 3 -eq $(grep $body_sha1 $tmp | wc -l)
+}
+
+t_begin "kill server" && kill $rainbows_pid
+
+t_begin "no errors in stderr log" && check_stderr
+
+t_done
diff --git a/t/test_isolate.rb b/t/test_isolate.rb
index 5c7f21d..9c685f8 100644
--- a/t/test_isolate.rb
+++ b/t/test_isolate.rb
@@ -16,7 +16,7 @@ $stdout.reopen($stderr)
 Isolate.now!(opts) do
   gem 'rack', '1.1.0' # Cramp currently requires ~> 1.1.0
   gem 'kgio', '2.0.0'
-  gem 'unicorn', '3.0.0'
+  gem 'unicorn', '3.0.1'
   gem 'kcar', '0.1.1'
 
   if engine == "ruby"