From 0cd65fa1e01be369b270c72053cf21a3d6bcb45f Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Mon, 19 Jul 2010 10:10:05 +0000 Subject: ensure stream response bodies get closed Some middlewares such as Clogger rely on wrapping the body having the close method called on it for logging. --- t/t0031-close-pipe-response.sh | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 t/t0031-close-pipe-response.sh (limited to 't/t0031-close-pipe-response.sh') diff --git a/t/t0031-close-pipe-response.sh b/t/t0031-close-pipe-response.sh new file mode 100644 index 0000000..7439b5f --- /dev/null +++ b/t/t0031-close-pipe-response.sh @@ -0,0 +1,30 @@ +#!/bin/sh +. ./test-lib.sh + +t_plan 5 "close pipe response for $model" + +t_begin "setup and startup" && { + rtmpfiles err out + rainbows_setup $model + export fifo + rainbows -E none -D close-pipe-response.ru -c $unicorn_config + rainbows_wait_start +} + +t_begin "single request matches" && { + cat $fifo > $out & + test x'hello world' = x"$(curl -sSfv 2> $err http://$listen/)" +} + +t_begin "body.close called" && { + wait # for cat $fifo + grep CLOSING $out || die "body.close not logged" +} + +t_begin "shutdown server" && { + kill -QUIT $rainbows_pid +} + +t_begin "check stderr" && check_stderr + +t_done -- cgit v1.2.3-24-ge0c7