test.sh 952 Bytes
Newer Older
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
PORT=$(grep -Po 'port: \K.*?(?=,)' config_dist.js)
NAME=$(grep -Po " id: '\K.*?(?=')" config_dist.js)
echo "Testing service $NAME on port $PORT"

echo "Service description"
curl -I http://127.0.0.1:$PORT > $NAME-test.txt
grep "HTTP/" $NAME-test.txt
echo "Service check"
curl -I http://127.0.0.1:$PORT/api/v1/check > $NAME-test.txt
grep "HTTP/" $NAME-test.txt
echo "Service statistics"
curl -I http://127.0.0.1:$PORT/api/v1/statistics > $NAME-test.txt
grep "HTTP/" $NAME-test.txt
echo "Service config"
curl -I http://127.0.0.1:$PORT/api/v1/service/config > $NAME-test.txt
grep "HTTP/" $NAME-test.txt

echo "Functional test"

cp README.MD $NAME-test-input.txt
curl --form content=@$NAME-test-input.txt http://127.0.0.1:$PORT/api/v1/service > $NAME-test.txt

echo ""
SID=$(grep -Po '"sessionId":"\K.*?(?=")' $NAME-test.txt)
status=$(grep -Po '"message":"\K.*?(?=")' $NAME-test.txt)
echo "Session $SID - $status"

rm $NAME-test.txt
rm $NAME-test-input.txt