summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2010-11-18 07:44:47 +0800
committerEric Wong <normalperson@yhbt.net>2010-11-18 07:46:04 +0800
commit859593b418db7e5fd93295a7a8b15de56cc4f6dd (patch)
treec0ad9eaeed7d61886d766e3f841c1e557cdfad6d
parenta6d96b61c2d81af077d55f43121c8472aa095447 (diff)
This will help ensure we trap our own errors properly
in the future.
(cherry picked from commit eda408603edc51f10f17217c767b31a45eb6c627)
-rwxr-xr-xt/t0002-parser-error.sh31
1 files changed, 31 insertions, 0 deletions
diff --git a/t/t0002-parser-error.sh b/t/t0002-parser-error.sh
new file mode 100755
index 0000000..9a3e7cf
--- /dev/null
+++ b/t/t0002-parser-error.sh
@@ -0,0 +1,31 @@
+#!/bin/sh
+. ./test-lib.sh
+t_plan 5 "parser error test"
+
+t_begin "setup and startup" && {
+        unicorn_setup
+        unicorn -D env.ru -c $unicorn_config
+        unicorn_wait_start
+}
+
+t_begin "send a bad request" && {
+        (
+                printf 'GET / HTTP/1/1\r\nHost: example.com\r\n\r\n'
+                cat $fifo > $tmp &
+                wait
+                echo ok > $ok
+        ) | socat - TCP:$listen > $fifo
+        test xok = x$(cat $ok)
+}
+
+dbgcat tmp
+
+t_begin "response should be a 400" && {
+        grep -F 'HTTP/1.1 400 Bad Request' $tmp
+}
+
+t_begin "server stderr should be clean" && check_stderr
+
+t_begin "term signal sent" && kill $unicorn_pid
+
+t_done