-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·53 lines (41 loc) · 1022 Bytes
/
build.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
41
42
43
44
45
46
47
48
49
50
51
52
#!/bin/bash
echo "Running verify"
sbt test
echo "Running func tests"
echo "Starting server"
trap 'kill -TERM $SERVER_PID' TERM INT
./target/universal/stage/bin/scala-api-boilerplate &
SERVER_PID=$!
PARENT_PID=$$
echo "Waiting for app to start...server pid is $SERVER_PID; parent pid is $PARENT_PID"
DATA=""
RETRY=30
while [ $RETRY -gt 0 ]
do
DATA=$(nc -v -z localhost 8080)
if [ $? -eq 0 ]
then
break
else
echo "Retrying Again" >&2
let RETRY-=1
sleep 1
if [ $RETRY -eq 0 ]
then
echo "Exceeded retries waiting for app to be ready, failing"
exit 1
fi
fi
done
echo "Server started, running func tests"
cd functional_test
python3 ./run.py live_tests -v
FUNC_TEST_RESULT=$?
echo "Functional tests completed with status $FUNC_TEST_RESULT, stopping server with PID $SERVER_PID, PPID $PARENT_PID"
kill $SERVER_PID
wait $SERVER_PID
trap - TERM INT
wait $SERVER_PID
# kill -9 $PARENT_PID
echo "DONE!"
exit $FUNC_TEST_RESULT