#!/bin/sh . ./test-lib.sh t_plan 9 "reloading unset config resets defaults" t_begin "setup and start" && { unicorn_setup rtmpfiles unicorn_config_orig before_reload after_reload cat $unicorn_config > $unicorn_config_orig cat >> $unicorn_config < $tmp } t_begin "replace config file with original(-ish)" && { grep -v ^pid < $unicorn_config_orig > $unicorn_config cat >> $unicorn_config </dev/null do sleep 1 done while ! grep reaped < $r_err >/dev/null do sleep 1 done grep 'done reloading' $r_err >/dev/null } t_begin "ensure worker is started" && { curl -sSf http://$listen/ > $tmp } t_begin "pid file no longer exists" && { if test -f $pid then die "pid=$pid should not exist" fi } t_begin "killing succeeds" && { kill $unicorn_pid } t_begin "check stderr" && { check_stderr } t_begin "ensure reloading restored settings" && { awk < $after_reload -F'|' ' $1 != "before_fork" && $2 != $3 { print $0; exit(1) } ' } t_done