-
Notifications
You must be signed in to change notification settings - Fork 5
/
all_tests.sh
executable file
·53 lines (37 loc) · 1.04 KB
/
all_tests.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
53
#!/bin/bash
# Adapted from pauljamescleary/scala-petstore functional test script
./script/travis_init.sh
npm i -g yarn gulp-cli
sbt ++$TRAVIS_SCALA_VERSION exampleServerJVM/stage
echo "Starting server"
trap 'kill -TERM $SERVER_PID' TERM INT
./example-server/jvm/target/universal/stage/bin/example-server &
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 all tests"
sbt ++$TRAVIS_SCALA_VERSION jvm:test && sbt ++$TRAVIS_SCALA_VERSION js:test
TEST_RES=$?
echo "Scala js tests completed with status $TEST_RES"
kill $SERVER_PID
wait $SERVER_PID
trap - TERM INT
wait $SERVER_PID
echo "DONE!"
exit $TEST_RES