require 'pp' if $DEBUG is set by Rack app
[unicorn.git] / t / t0200-rack-hijack.sh
blobde3eb82ff1b972a8e51fae2314ba62bd8d24d725
1 #!/bin/sh
2 . ./test-lib.sh
3 t_plan 5 "rack.hijack tests (Rack 1.5+ (Rack::VERSION >= [ 1,2]))"
5 t_begin "setup and start" && {
6 unicorn_setup
7 unicorn -D -c $unicorn_config hijack.ru
8 unicorn_wait_start
11 t_begin "check request hijack" && {
12 test "xrequest.hijacked" = x"$(curl -sSfv http://$listen/hijack_req)"
15 t_begin "check response hijack" && {
16 test "xresponse.hijacked" = x"$(curl -sSfv http://$listen/hijack_res)"
19 t_begin "killing succeeds after hijack" && {
20 kill $unicorn_pid
23 t_begin "check stderr for hijacked body close" && {
24 check_stderr
25 grep 'closed DieIfUsed 1\>' $r_err
26 grep 'closed DieIfUsed 2\>' $r_err
27 ! grep 'closed DieIfUsed 3\>' $r_err
30 t_done