Sha256: e1a178ca8ce376d22e0aba0946762aed32d15de1938572971e969395d11a3136

Contents?: true

Size: 1.38 KB

Versions: 10

Compression:

Stored size: 1.38 KB

Contents

#!/bin/sh
CONFIG_RU=${CONFIG_RU-'async-response.ru'}
. ./test-lib.sh

skip_models Base WriterThreadPool WriterThreadSpawn
skip_models StreamResponseEpoll

case $CONFIG_RU in
*no-autochunk.ru)
	t_plan 7 "async response w/o autochunk for $model"
	skip_autochunk=true
	;;
*)
	t_plan 6 "async response for $model"
	skip_autochunk=false
	;;
esac

t_begin "setup and start" && {
	rainbows_setup
	rtmpfiles a b c curl_err
	# can't load Rack::Lint here since it'll cause Rev to slurp
	rainbows -E none -D $CONFIG_RU -c $unicorn_config
	rainbows_wait_start
}

t_begin "send async requests off in parallel" && {
	t0=$(date +%s)
	( curl --no-buffer -sSf http://$listen/ 2>> $curl_err | utee $a) &
	( curl --no-buffer -sSf http://$listen/ 2>> $curl_err | utee $b) &
	( curl --no-buffer -sSf http://$listen/ 2>> $curl_err | utee $c) &
	wait
	t1=$(date +%s)
}

t_begin "ensure elapsed requests were processed in parallel" && {
	elapsed=$(( $t1 - $t0 ))
	echo "elapsed=$elapsed < 30"
	test $elapsed -lt 30
}

t_begin "termination signal sent" && {
	kill $rainbows_pid
}

dbgcat a
dbgcat b
dbgcat c
dbgcat r_err
dbgcat curl_err

t_begin "no errors from curl" && {
	test ! -s $curl_err
}

t_begin "no errors in stderr" && check_stderr

dbgcat r_err

if $skip_autochunk
then
	t_begin "no responses are chunked" && {
		test x"$(cat $a)" = x0123456789
		test x"$(cat $b)" = x0123456789
		test x"$(cat $c)" = x0123456789
	}
fi

t_done

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
rainbows-4.4.3 t/t0200-async-response.sh
rainbows-4.4.2 t/t0200-async-response.sh
rainbows-4.4.1.1.gd5c8c t/t0200-async-response.sh
rainbows-4.4.1 t/t0200-async-response.sh
rainbows-4.4.0 t/t0200-async-response.sh
rainbows-4.3.1 t/t0200-async-response.sh
rainbows-4.3.0 t/t0200-async-response.sh
rainbows-4.2.0 t/t0200-async-response.sh
rainbows-4.1.0 t/t0200-async-response.sh
rainbows-4.0.0 t/t0200-async-response.sh