Sha256: 277431efa71f4f3f0e7ebc88d9e3016b698a38a7b03b6c4bef1b53a82c5e3ca8

Contents?: true

Size: 1.19 KB

Versions: 1

Compression:

Stored size: 1.19 KB

Contents

#!/bin/sh
. ./test-lib.sh
t_plan 6 "keepalive_requests limit tests for $model"

t_begin "setup and start" && {
	rainbows_setup $model 50 666
	rtmpfiles curl_out curl_err
	grep 'keepalive_timeout 666' $unicorn_config
        ed -s $unicorn_config <<EOF
,s/listen.*/&, :tcp_nodelay => true/
w
EOF
	grep nodelay $unicorn_config
	rainbows -E none -D env.ru -c $unicorn_config
	rainbows_wait_start
}

t_begin "curl requests hit default keepalive_requests limit" && {
	curl -sSfv http://$listen/[0-101] > $curl_out 2> $curl_err
	test 1 -eq $(grep 'Connection: close' $curl_err |wc -l)
	test 101 -eq $(grep 'Connection: keep-alive' $curl_err |wc -l)
}

t_begin "reload with smaller keepalive_requests limit" && {
	ed -s $unicorn_config <<EOF
,g/Rainbows!/
a
  keepalive_requests 5
.
w
EOF
	kill -HUP $rainbows_pid
	test x"$(cat $fifo)" = xSTART
}

t_begin "curl requests hit smaller keepalive_requests limit" && {
	rm -f $curl_out $curl_err
	curl -sSfv http://$listen/[1-13] > $curl_out 2> $curl_err
	test 2 -eq $(grep 'Connection: close' $curl_err |wc -l)
	test 11 -eq $(grep 'Connection: keep-alive' $curl_err |wc -l)
}

t_begin "killing succeeds" && {
	kill $rainbows_pid
}

t_begin "check stderr" && {
	check_stderr
}

t_done

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rainbows-2.1.0 t/t0040-keepalive_requests-setting.sh