From 9caff8ecc7912306366cebb9c57b65ab12fde5ad Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Tue, 11 Jan 2011 16:36:08 -0800 Subject: add write-on-close test from Unicorn We need to ensure this esoteric feature keeps working for some people. --- t/t0025-write-on-close.sh | 23 +++++++++++++++++++++++ t/write-on-close.ru | 11 +++++++++++ 2 files changed, 34 insertions(+) create mode 100755 t/t0025-write-on-close.sh create mode 100644 t/write-on-close.ru diff --git a/t/t0025-write-on-close.sh b/t/t0025-write-on-close.sh new file mode 100755 index 0000000..84fc2f3 --- /dev/null +++ b/t/t0025-write-on-close.sh @@ -0,0 +1,23 @@ +#!/bin/sh +. ./test-lib.sh +t_plan 4 "write-on-close tests for funky response-bodies" + +t_begin "setup and start" && { + rainbows_setup + rainbows -D -c $unicorn_config write-on-close.ru + rainbows_wait_start +} + +t_begin "write-on-close response body succeeds" && { + test xGoodbye = x"$(curl -sSf --http1.0 http://$listen/)" +} + +t_begin "killing succeeds" && { + kill $rainbows_pid +} + +t_begin "check stderr" && { + check_stderr +} + +t_done diff --git a/t/write-on-close.ru b/t/write-on-close.ru new file mode 100644 index 0000000..54a2f2e --- /dev/null +++ b/t/write-on-close.ru @@ -0,0 +1,11 @@ +class WriteOnClose + def each(&block) + @callback = block + end + + def close + @callback.call "7\r\nGoodbye\r\n0\r\n\r\n" + end +end +use Rack::ContentType, "text/plain" +run(lambda { |_| [ 200, [%w(Transfer-Encoding chunked)], WriteOnClose.new ] }) -- cgit v1.2.3-24-ge0c7