Sha256: 876c0aa757162cc56f369df166ae0bcbbc2c9b08c844490bc343d7afbfd8bf98

Contents?: true

Size: 1.17 KB

Versions: 28

Compression:

Stored size: 1.17 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" && {
	nr=30
	while kill -0 $worker_pid 2>/dev/null && test $nr -gt 0
	do
		nr=$(( $nr - 1))
		sleep 1
	done
	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

28 entries across 28 versions & 1 rubygems

Version Path
rainbows-5.2.1 t/t0007-worker-follows-master-to-death.sh
rainbows-5.2.0 t/t0007-worker-follows-master-to-death.sh
rainbows-5.1.1 t/t0007-worker-follows-master-to-death.sh
rainbows-5.1.0 t/t0007-worker-follows-master-to-death.sh
rainbows-5.0.0.5.ge717 t/t0007-worker-follows-master-to-death.sh
rainbows-5.0.0 t/t0007-worker-follows-master-to-death.sh
rainbows-4.7.0 t/t0007-worker-follows-master-to-death.sh
rainbows-4.6.2 t/t0007-worker-follows-master-to-death.sh
rainbows-4.6.1 t/t0007-worker-follows-master-to-death.sh
rainbows-4.6.0.4.g4108 t/t0007-worker-follows-master-to-death.sh
rainbows-4.6.0 t/t0007-worker-follows-master-to-death.sh
rainbows-4.5.0 t/t0007-worker-follows-master-to-death.sh
rainbows-4.4.3 t/t0007-worker-follows-master-to-death.sh
rainbows-4.4.2 t/t0007-worker-follows-master-to-death.sh
rainbows-4.4.1.1.gd5c8c t/t0007-worker-follows-master-to-death.sh
rainbows-4.4.1 t/t0007-worker-follows-master-to-death.sh
rainbows-4.4.0 t/t0007-worker-follows-master-to-death.sh
rainbows-4.3.1 t/t0007-worker-follows-master-to-death.sh
rainbows-4.3.0 t/t0007-worker-follows-master-to-death.sh
rainbows-4.2.0 t/t0007-worker-follows-master-to-death.sh