Skip to content

Commit 7c730e9

Browse files
committed
add ability to forcebly stop test script while it waits for services.
1 parent 868816e commit 7c730e9

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

bin/test

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
# $1 host
55
# $2 port
66
# $3 attempts
7+
8+
FORCE_EXIT=false
9+
710
function waitForService()
811
{
912
ATTEMPTS=0
@@ -14,13 +17,20 @@ function waitForService()
1417
printf "service is not running %s:%s\n" $1 $2
1518
exit 1
1619
fi
20+
if [ "$FORCE_EXIT" = true ]; then
21+
exit;
22+
fi
23+
1724
sleep 1
1825
done
1926

2027
printf "service is online %s:%s\n" $1 $2
2128
}
2229

30+
trap "FORCE_EXIT=true" SIGTERM SIGINT
31+
2332
waitForService rabbitmq 5672 50
33+
waitForService rabbitmq_ssl 5671 50
2434
waitForService mysql 3306 50
2535
waitForService redis 6379 50
2636
waitForService beanstalkd 11300 50

0 commit comments

Comments
 (0)