Sha256: ccbe095bb269ed8905614e7e549ff6c175bded0c72023265eebee18ee1e9c179

Contents?: true

Size: 1.09 KB

Versions: 10

Compression:

Stored size: 1.09 KB

Contents

#!/bin/sh
. ./test-lib.sh
t_plan 7 "ensure worker follows master to death"

t_begin "setup" && {
	rtmpfiles curl_err curl_out
	rainbows_setup
        echo timeout 3 >> $unicorn_config
	rainbows -D -c $unicorn_config worker-follows-master-to-death.ru
	rainbows_wait_start
}

t_begin "read worker PID" && {
	worker_pid=$(curl -sSf http://$listen/pid)
	t_info "worker_pid=$worker_pid"
}

t_begin "start a long sleeping request" && {
	curl -sSfv -T- </dev/null http://$listen/sleep/2 >$curl_out 2> $fifo &
	curl_pid=$!
	t_info "curl_pid=$curl_pid"
}

t_begin "nuke the master once we're connected" && {
	awk -v rainbows_pid=$rainbows_pid '
{ print $0 }
/100 Continue/ {
	print "awk: sending SIGKILL to", rainbows_pid
	system("kill -9 "rainbows_pid)
}' < $fifo > $curl_err
	wait
}

t_begin "worker is no longer running" && {
	sleep 6
	kill -0 $worker_pid 2> $tmp && false
	test -s $tmp
}

t_begin "sleepy curl request is no longer running" && {
	kill -0 $curl_pid 2> $tmp && false
	test -s $tmp
}

t_begin "sleepy curl request completed gracefully" && {
	test x$(cat $curl_out) = x$worker_pid
	dbgcat curl_err
}

t_done

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
rainbows-0.92.0 t/t0007-worker-follows-master-to-death.sh
rainbows-0.91.1 t/t0007-worker-follows-master-to-death.sh
rainbows-0.91.0 t/t0007-worker-follows-master-to-death.sh
rainbows-0.90.2 t/t0007-worker-follows-master-to-death.sh
rainbows-0.90.1 t/t0007-worker-follows-master-to-death.sh
rainbows-0.90.0 t/t0007-worker-follows-master-to-death.sh
rainbows-0.9.0 t/t0007-worker-follows-master-to-death.sh
rainbows-0.8.0 t/t0007-worker-follows-master-to-death.sh
rainbows-0.7.0 t/t0007-worker-follows-master-to-death.sh
rainbows-0.6.0 t/t0007-worker-follows-master-to-death.sh