|
597
|
1 |
#!/bin/bash |
|
|
2 |
|
|
|
3 |
echo "---------------------" |
|
|
4 |
echo "Starting test server" |
|
|
5 |
|
|
|
6 |
pushd ../../../../dev > /dev/null |
|
|
7 |
vagrant ssh -c "/srv/comt/src/cm/scripts/test-suite/start-testserver.sh" |
|
|
8 |
popd > /dev/null |
|
|
9 |
|
|
|
10 |
SERVER_IP=`grep WORKSPACE_URL workspace.info.full.js | tail -n -1 | cut -d: -f2 | tr -d " //"` |
|
|
11 |
SERVER_PORT=`grep WORKSPACE_URL ./workspace.info.full.js | tail -n -1 | cut -d: -f3 | tr -d " ');"` |
|
|
12 |
|
|
|
13 |
if [[ -x `which nc` ]]; then |
|
|
14 |
SERVER_TEST_CMD="nc -z $SERVER_IP $SERVER_PORT" |
|
|
15 |
elif [[ -x `which curl` ]]; then |
|
|
16 |
SERVER_TEST_CMD="curl --output /dev/null --silent --head --fail http://$SERVER_IP:$SERVER_PORT" |
|
|
17 |
elif [[ -x `which wget` ]]; then |
|
|
18 |
SERVER_TEST_CMD="wget -q --spider http://$SERVER_IP:$SERVER_PORT" |
|
|
19 |
fi |
|
|
20 |
echo "$SERVER_TEST_CMD" |
|
|
21 |
|
|
|
22 |
echo "---------------------" |
|
|
23 |
if [[ -z "$SERVER_TEST_CMD" ]]; then |
|
|
24 |
echo "Waiting 10 seconds to let test server start" |
|
|
25 |
sleep 10 |
|
|
26 |
else |
|
|
27 |
for i in {1..10}; do |
|
|
28 |
echo "waiting 5 seconds to let the test server $SERVER_IP:$SERVER_PORT start" |
|
|
29 |
sleep 5 |
|
|
30 |
if $SERVER_TEST_CMD; then |
|
|
31 |
break |
|
|
32 |
fi |
|
|
33 |
done |
|
|
34 |
if [ $i -eq 10 ]; then |
|
|
35 |
echo "could not start test server $SERVER_IP:$SERVER_PORT" |
|
|
36 |
exit 1 |
|
|
37 |
fi |
|
|
38 |
fi |
|
|
39 |
|
|
|
40 |
echo "---------------------" |
|
|
41 |
echo "Starting karma tests" |
|
|
42 |
. ./start-test-suite.sh ./karma.conf.full.js $@ |
|
|
43 |
|
|
|
44 |
echo "---------------------" |
|
|
45 |
echo "stopping test server + output test server logs" |
|
|
46 |
|
|
|
47 |
pushd ../../../../dev > /dev/null |
|
|
48 |
vagrant ssh -c "/srv/comt/src/cm/scripts/test-suite/clean-testserver.sh" |
|
|
49 |
popd /dev/null |
|
|
50 |
|
|
|
51 |
|