about summary refs log tree commit homepage
path: root/t/t9001-oob_gc.sh
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2011-04-29 15:48:35 -0700
committerEric Wong <normalperson@yhbt.net>2011-04-30 01:45:55 +0000
commitfe0dd93cd9cb97b46f6cfb4b1e370e38717a93f0 (patch)
tree5e5c45c385ade1bad0e0c6ec6e5eedd379181275 /t/t9001-oob_gc.sh
parentd385bc4f3ed7b783b7414f5d34299bd2bf242fe6 (diff)
downloadunicorn-fe0dd93cd9cb97b46f6cfb4b1e370e38717a93f0.tar.gz
This was broken since v3.3.1[1] and v1.1.6[2] since nginx relies on
a closed socket (and not Content-Length/Transfer-Encoding) to
detect a response completion.  We have to close the client
socket before invoking GC to ensure the client sees the response
in a timely manner.

[1] - commit b72a86f66c722d56a6d77ed1d2779ace6ad103ed
[2] - commit b7a0074284d33352bb9e732c660b29162f34bf0e

(cherry picked from commit faeb3223636c39ea8df4017dc9a9d39ac649b26d)

Conflicts:

	examples/big_app_gc.rb
	lib/unicorn/oob_gc.rb
Diffstat (limited to 't/t9001-oob_gc.sh')
-rwxr-xr-xt/t9001-oob_gc.sh47
1 files changed, 47 insertions, 0 deletions
diff --git a/t/t9001-oob_gc.sh b/t/t9001-oob_gc.sh
new file mode 100755
index 0000000..dcd8100
--- /dev/null
+++ b/t/t9001-oob_gc.sh
@@ -0,0 +1,47 @@
+#!/bin/sh
+. ./test-lib.sh
+t_plan 9 "OobGC test"
+
+t_begin "setup and start" && {
+        unicorn_setup
+        unicorn -D -c $unicorn_config oob_gc.ru
+        unicorn_wait_start
+}
+
+t_begin "test default interval (4 requests)" && {
+        test xfalse = x$(curl -vsSf http://$listen/ 2>> $tmp)
+        test xfalse = x$(curl -vsSf http://$listen/ 2>> $tmp)
+        test xfalse = x$(curl -vsSf http://$listen/ 2>> $tmp)
+        test xfalse = x$(curl -vsSf http://$listen/ 2>> $tmp)
+}
+
+t_begin "GC starting-request returns immediately" && {
+        test xfalse = x$(curl -vsSf http://$listen/ 2>> $tmp)
+}
+
+t_begin "GC is started after 5 requests" && {
+        test xtrue = x$(curl -vsSf http://$listen/ 2>> $tmp)
+}
+
+t_begin "reset GC" && {
+        test xfalse = x$(curl -vsSf -X POST http://$listen/gc_reset 2>> $tmp)
+}
+
+t_begin "test default interval again (3 requests)" && {
+        test xfalse = x$(curl -vsSf http://$listen/ 2>> $tmp)
+        test xfalse = x$(curl -vsSf http://$listen/ 2>> $tmp)
+        test xfalse = x$(curl -vsSf http://$listen/ 2>> $tmp)
+}
+
+t_begin "GC is started after 5 requests" && {
+        test xtrue = x$(curl -vsSf http://$listen/ 2>> $tmp)
+}
+
+t_begin "killing succeeds" && {
+        kill -QUIT $unicorn_pid
+}
+
+t_begin "check_stderr" && check_stderr
+dbgcat r_err
+
+t_done