about summary refs log tree commit homepage
path: root/t
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2010-10-28 02:17:25 +0000
committerEric Wong <normalperson@yhbt.net>2010-10-28 02:17:25 +0000
commitc4579db76b9ed5b0286fad852e798e8a890f093c (patch)
tree71ff2073fc59b20467bdcd0b7b37fe7841099c84 /t
parent83644e02068311c7ff9cdbc63efd4764d1518138 (diff)
downloadrainbows-c4579db76b9ed5b0286fad852e798e8a890f093c.tar.gz
For consistency, changed settings are reset back to
their default values if they are removed or commented
out from the config file.
Diffstat (limited to 't')
-rw-r--r--t/t0018-reload-restore-settings.sh60
1 files changed, 60 insertions, 0 deletions
diff --git a/t/t0018-reload-restore-settings.sh b/t/t0018-reload-restore-settings.sh
new file mode 100644
index 0000000..fc61f0c
--- /dev/null
+++ b/t/t0018-reload-restore-settings.sh
@@ -0,0 +1,60 @@
+#!/bin/sh
+. ./test-lib.sh
+t_plan 8 "reload restore settings for $model"
+
+t_begin "setup and start" && {
+        rtmpfiles orig_config
+        rainbows_setup
+        cat $unicorn_config > $orig_config
+        rainbows -D -c $unicorn_config -l $listen env.ru
+        rainbows_wait_start
+}
+
+t_begin "HTTP request confirms we're running the correct model" && {
+        curl -sSfv http://$listen/ | grep "\"rainbows.model\"=>:$model"
+}
+
+t_begin "clobber config and reload" && {
+        cat > $unicorn_config <<EOF
+stderr_path "$r_err"
+EOF
+        kill -HUP $rainbows_pid
+        while ! egrep '(done|error) reloading' $r_err >/dev/null
+        do
+                sleep 1
+        done
+
+        grep 'done reloading' $r_err >/dev/null
+}
+
+t_begin "HTTP request confirms we're on the default model" && {
+        curl -sSfv http://$listen/ | \
+          grep "\"rainbows.model\"=>:Base" >/dev/null
+}
+
+t_begin "restore config and reload" && {
+        cat $orig_config > $unicorn_config
+        > $r_err
+        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 "HTTP request confirms we're back on the correct model" && {
+        curl -sSfv http://$listen/ | \
+          grep "\"rainbows.model\"=>:$model" >/dev/null
+}
+
+t_begin "killing succeeds" && {
+        kill $rainbows_pid
+}
+
+t_begin "check stderr" && {
+        check_stderr
+}
+
+t_done