about summary refs log tree commit homepage
path: root/t/t0014-config-conflict.sh
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2010-02-24 15:04:15 -0800
committerEric Wong <normalperson@yhbt.net>2010-02-24 15:24:54 -0800
commita5064bc0bb549ca60e3e4d5f1a912bafa46c7f5f (patch)
treeb6e074a3e4104de4b4cf45b8579414692ee7c547 /t/t0014-config-conflict.sh
parentecdc78d04e874f64bfea1b787aa8f3d469df8e79 (diff)
downloadrainbows-a5064bc0bb549ca60e3e4d5f1a912bafa46c7f5f.tar.gz
The Unicorn.builder helper will help us avoid namespace
conflicts inside config.ru, allowing us to pass tests.

While we're at it, port some tests over from the latest
unicorn.git for dealing with bad configs.
Diffstat (limited to 't/t0014-config-conflict.sh')
-rwxr-xr-xt/t0014-config-conflict.sh50
1 files changed, 50 insertions, 0 deletions
diff --git a/t/t0014-config-conflict.sh b/t/t0014-config-conflict.sh
new file mode 100755
index 0000000..b91355d
--- /dev/null
+++ b/t/t0014-config-conflict.sh
@@ -0,0 +1,50 @@
+#!/bin/sh
+. ./test-lib.sh
+t_plan 6 "config variables conflict with preload_app"
+
+t_begin "setup and start" && {
+        rainbows_setup
+        rtmpfiles ru rutmp
+
+        cat > $ru <<\EOF
+use Rack::ContentLength
+use Rack::ContentType, "text/plain"
+config = ru = { "hello" => "world" }
+run lambda { |env| [ 200, {}, [ ru.inspect << "\n" ] ] }
+EOF
+        echo 'preload_app true' >> $unicorn_config
+        rainbows -D -c $unicorn_config $ru
+        rainbows_wait_start
+}
+
+t_begin "hit with curl" && {
+        out=$(curl -sSf http://$listen/)
+        test x"$out" = x'{"hello"=>"world"}'
+}
+
+t_begin "modify rackup file" && {
+        sed -e 's/world/WORLD/' < $ru > $rutmp
+        mv $rutmp $ru
+}
+
+t_begin "reload signal succeeds" && {
+        kill -HUP $rainbows_pid
+        rainbows_wait_start
+        while ! egrep '(done|error) reloading' < $r_err >/dev/null
+        do
+                sleep 1
+        done
+
+        grep 'done reloading' $r_err >/dev/null
+}
+
+t_begin "hit with curl" && {
+        out=$(curl -sSf http://$listen/)
+        test x"$out" = x'{"hello"=>"WORLD"}'
+}
+
+t_begin "killing succeeds" && {
+        kill $rainbows_pid
+}
+
+t_done