3 t_plan
12 "client_body_buffer_size settings"
5 t_begin
"setup and start" && {
7 rtmpfiles unicorn_config_tmp one_meg
8 dd if=/dev
/zero bs
=1M count
=1 of
=$one_meg
9 cat >> $unicorn_config <<EOF
10 after_fork do |server, worker|
11 File.open("$fifo", "wb") { |fp| fp.syswrite "START" }
14 cat $unicorn_config > $unicorn_config_tmp
15 echo client_body_buffer_size
0 >> $unicorn_config
16 unicorn
-D -c $unicorn_config t0116.ru
18 fs_class
=Unicorn
::TmpIO
21 test x
"$(cat $fifo)" = xSTART
24 t_begin
"class for a zero-byte file should be StringIO" && {
26 test xStringIO
= x
"$(curl -T $tmp -sSf http://$listen/input_class)"
29 t_begin
"class for a 1 byte file should be filesystem-backed" && {
31 test x
$fs_class = x
"$(curl -T $tmp -sSf http://$listen/tmp_class)"
34 t_begin
"reload with default client_body_buffer_size" && {
35 mv $unicorn_config_tmp $unicorn_config
36 kill -HUP $unicorn_pid
37 test x
"$(cat $fifo)" = xSTART
40 t_begin
"class for a 1 byte file should be memory-backed" && {
42 test x
$mem_class = x
"$(curl -T $tmp -sSf http://$listen/tmp_class)"
45 t_begin
"class for a random blob file should be filesystem-backed" && {
46 resp
="$(curl -T random_blob -sSf http://$listen/tmp_class)"
47 test x
$fs_class = x
"$resp"
50 t_begin
"one megabyte file should be filesystem-backed" && {
51 resp
="$(curl -T $one_meg -sSf http://$listen/tmp_class)"
52 test x
$fs_class = x
"$resp"
55 t_begin
"reload with a big client_body_buffer_size" && {
56 echo "client_body_buffer_size(1024 * 1024)" >> $unicorn_config
57 kill -HUP $unicorn_pid
58 test x
"$(cat $fifo)" = xSTART
61 t_begin
"one megabyte file should be memory-backed" && {
62 resp
="$(curl -T $one_meg -sSf http://$listen/tmp_class)"
63 test x
$mem_class = x
"$resp"
66 t_begin
"one megabyte + 1 byte file should be filesystem-backed" && {
68 resp
="$(curl -T $one_meg -sSf http://$listen/tmp_class)"
69 test x
$fs_class = x
"$resp"
72 t_begin
"killing succeeds" && {
76 t_begin
"check stderr" && {