Sha256: 90c80601bf832c39c9dac53c491e419585720b3acf836bac3eb9726dbf69684d

Contents?: true

Size: 1.38 KB

Versions: 12

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=$(unix_time)
	( curl --no-buffer -sSf http://$listen/ 2>> $curl_err | tee $a) &
	( curl --no-buffer -sSf http://$listen/ 2>> $curl_err | tee $b) &
	( curl --no-buffer -sSf http://$listen/ 2>> $curl_err | tee $c) &
	wait
	t1=$(unix_time)
}

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

12 entries across 12 versions & 1 rubygems

Version Path
rainbows-5.2.1 t/t0200-async-response.sh
rainbows-5.2.0 t/t0200-async-response.sh
rainbows-5.1.1 t/t0200-async-response.sh
rainbows-5.1.0 t/t0200-async-response.sh
rainbows-5.0.0.5.ge717 t/t0200-async-response.sh
rainbows-5.0.0 t/t0200-async-response.sh
rainbows-4.7.0 t/t0200-async-response.sh
rainbows-4.6.2 t/t0200-async-response.sh
rainbows-4.6.1 t/t0200-async-response.sh
rainbows-4.6.0.4.g4108 t/t0200-async-response.sh
rainbows-4.6.0 t/t0200-async-response.sh
rainbows-4.5.0 t/t0200-async-response.sh