rainbows.git  about / heads / tags
Unicorn for sleepy apps and slow clients
blob 4e4012c4a1c7831d4afbc50428224f014f8655c0 947 bytes (raw)
$ git show HEAD:t/t9001-sendfile-to-path.sh	# shows this blob on the CLI

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
 
#!/bin/sh
. ./test-lib.sh
skip_models StreamResponseEpoll

t_plan 7 "Sendfile middleware test for $model"

t_begin "configure and start" && {
	rtmpfiles curl_err
	rainbows_setup

	# do not allow default middleware to be loaded since it may
	# kill body#to_path
	rainbows -E none -D t9001.ru -c $unicorn_config
	rainbows_wait_start
	random_blob_sha1=$(rsha1 < random_blob)
}

t_begin "hit with curl" && {
	sha1=$(curl -sSfv http://$listen/ 2> $curl_err | rsha1)
}

t_begin "kill server" && {
	kill $rainbows_pid
}

t_begin "SHA1 matches source" && {
	test x$random_blob_sha1 = x$sha1
}

t_begin "no errors in Rainbows! stderr" && {
	check_stderr
}

t_begin "X-Sendfile does not show up in headers" && {
	dbgcat curl_err
	if grep -i x-sendfile $curl_err
	then
		die "X-Sendfile did show up!"
	fi
}

t_begin "Content-Length is set correctly in headers" && {
	expect=$(count_bytes < random_blob)
	grep "^< Content-Length: $expect" $curl_err
}

t_done

git clone https://yhbt.net/rainbows.git