-
Notifications
You must be signed in to change notification settings - Fork 436
Expand file tree
/
Copy pathtest.sh
More file actions
executable file
·78 lines (65 loc) · 1.95 KB
/
test.sh
File metadata and controls
executable file
·78 lines (65 loc) · 1.95 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#!/usr/bin/env bash
# wait for service
# $1 host
# $2 port
# $3 attempts
FORCE_EXIT=false
function waitForService()
{
ATTEMPTS=0
until nc -z $1 $2; do
printf "wait for service %s:%s\n" $1 $2
((ATTEMPTS++))
if [ $ATTEMPTS -ge $3 ]; then
printf "service is not running %s:%s\n" $1 $2
exit 1
fi
if [ "$FORCE_EXIT" = true ]; then
exit;
fi
sleep 1
done
printf "service is online %s:%s\n" $1 $2
}
function waitForServiceLocalStack()
{
waitForService localstack 4566 $1
ATTEMPTS=0
RESPONSE=''
READY=0
until [ $READY = 1 ]; do
printf "check readiness for service localstack:4566\n"
RESPONSE=$(curl -s http://localstack:4566/_localstack/health)
if [[ $RESPONSE == *'"sns": "available"'* && $RESPONSE == *'"sqs": "available"'* ]]; then
READY=1
fi
((ATTEMPTS++))
if [ $ATTEMPTS -ge $2 ]; then
printf "service is not ready localstack:4566\n"
exit 1
fi
if [ "$FORCE_EXIT" = true ]; then
exit;
fi
sleep 1
done
printf "service is ready localstack:4566\n"
}
trap "FORCE_EXIT=true" SIGTERM SIGINT
waitForService rabbitmq 5672 50
waitForService rabbitmqssl 5671 50
waitForService mysql 3306 50
waitForService postgres 5432 50
waitForService redis 6379 50
waitForService beanstalkd 11300 50
waitForService gearmand 4730 50
waitForService kafka 9092 50
waitForService mongo 27017 50
waitForService thruway 9090 50
waitForServiceLocalStack 50 50
php docker/bin/refresh-mysql-database.php || exit 1
php docker/bin/refresh-postgres-database.php || exit 1
php pkg/job-queue/Tests/Functional/app/console doctrine:database:create --if-not-exists || exit 1
php pkg/job-queue/Tests/Functional/app/console doctrine:schema:update --force || exit 1
#php pkg/enqueue-bundle/Tests/Functional/app/console.php config:dump-reference enqueue
bin/phpunit "$@"