about summary refs log tree commit homepage
path: root/t/t0101-rack-input-trailer.sh
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2009-10-24 20:41:15 -0700
committerEric Wong <normalperson@yhbt.net>2009-10-24 20:42:57 -0700
commit15fe80b3bff7b0d249ee32bcbbe1dfa116d3c629 (patch)
tree8edf5313e3ef41395b406706dd807b97e6321eb9 /t/t0101-rack-input-trailer.sh
parente77369a6bde35a4e8925d450aac85f328f87d208 (diff)
downloadrainbows-15fe80b3bff7b0d249ee32bcbbe1dfa116d3c629.tar.gz
This will make it easier to enable and manage tests for new
concurrency models.
Diffstat (limited to 't/t0101-rack-input-trailer.sh')
-rwxr-xr-xt/t0101-rack-input-trailer.sh68
1 files changed, 68 insertions, 0 deletions
diff --git a/t/t0101-rack-input-trailer.sh b/t/t0101-rack-input-trailer.sh
new file mode 100755
index 0000000..75528d6
--- /dev/null
+++ b/t/t0101-rack-input-trailer.sh
@@ -0,0 +1,68 @@
+#!/bin/sh
+. ./test-lib.sh
+test -r random_blob || die "random_blob required, run with 'make $0'"
+
+t_plan 11 "input trailer test $model"
+
+t_begin "setup and startup" && {
+        rtmpfiles curl_out
+        rainbows_setup $model
+        rainbows -D content-md5.ru -c $unicorn_config
+        rainbows_wait_start
+}
+
+t_begin "upload small blob" && {
+        (
+                cat $fifo > $tmp &
+                echo hello world | content-md5-put
+                wait
+                echo ok > $ok
+        ) | socat - TCP:$listen > $fifo
+        test xok = x"$(cat $ok)"
+}
+
+t_begin "HTTP response is OK" && fgrep 'HTTP/1.1 200 OK' $tmp
+t_begin "no errors in stderr log" && check_stderr
+
+t_begin "big blob request" && {
+        (
+                cat $fifo > $tmp &
+                content-md5-put < random_blob
+                wait
+                echo ok > $ok
+        ) | socat - TCP:$listen > $fifo
+        test xok = x"$(cat $ok)"
+}
+
+t_begin "HTTP response is OK" && fgrep 'HTTP/1.1 200 OK' $tmp
+t_begin "no errors in stderr log" && check_stderr
+
+t_begin "staggered blob upload" && {
+        (
+                cat $fifo > $tmp &
+                (
+                        dd bs=164 count=1 < random_blob
+                        sleep 2
+                        dd bs=4545 count=1 < random_blob
+                        sleep 2
+                        dd bs=1234 count=1 < random_blob
+                        echo subok > $ok
+                ) 2>/dev/null | content-md5-put
+                test xsubok = x"$(cat $ok)"
+                wait
+                echo ok > $ok
+        ) | socat - TCP:$listen > $fifo
+        test xok = x"$(cat $ok)"
+}
+
+t_begin "HTTP response is OK" && {
+        fgrep 'HTTP/1.1 200 OK' $tmp
+}
+
+t_begin "no errors in stderr log" && check_stderr
+
+t_begin "kill server" && {
+        kill $rainbows_pid
+}
+
+t_done