forked from twilio/twilio-oai-generator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
prism.sh
executable file
·40 lines (36 loc) · 1.2 KB
/
prism.sh
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
#!/bin/bash
set -e
cd examples/prism
docker-compose build
docker-compose up -d --force-recreate --remove-orphans
function wait_for() {
echo -n "Waiting for tests to complete"
for docker_test_service in "$@"; do
while true; do
if [[ "$(docker-compose ps -q "$docker_test_service" | xargs docker inspect -f "{{.State.Status}}")" != "exited" ]]; then
echo -n "."
sleep 10
else
break
fi
done
done
echo
}
EXIT_CODE=0
function check_status() {
docker_test_services=("$@")
for docker_test_service in "${docker_test_services[@]}"; do
if [[ $(docker-compose ps -q "$docker_test_service" | xargs docker inspect -f "{{.State.ExitCode}}") -ne 0 ]]; then
EXIT_CODE=$(("$EXIT_CODE" || $(docker-compose ps -q "$docker_test_service" | xargs docker inspect -f "{{.State.ExitCode}}")))
echo "Failed $docker_test_service with EXIT code $(docker-compose ps -q "$docker_test_service" | xargs docker inspect -f "{{.State.ExitCode}}")"
else
echo "$docker_test_service completed successfully"
fi
done
}
testing_services=("go-client-test" "java-test")
wait_for "${testing_services[@]}"
check_status "${testing_services[@]}"
docker-compose down
exit $EXIT_CODE