forked from kodekloudhub/devsecops
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathintegration-test.sh
More file actions
37 lines (28 loc) · 802 Bytes
/
integration-test.sh
File metadata and controls
37 lines (28 loc) · 802 Bytes
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
#!/bin/bash
#integration-test.sh
sleep 5s
PORT=$(kubectl -n default get svc ${serviceName} -o json | jq .spec.ports[].nodePort)
echo $PORT
echo $applicationURL:$PORT/$applicationURI
if [[ ! -z "$PORT" ]];
then
response=$(curl -s $applicationURL:$PORT$applicationURI)
http_code=$(curl -s -o /dev/null -w "%{http_code}" $applicationURL:$PORT$applicationURI)
if [[ "$response" == 100 ]];
then
echo "Increment Test Passed"
else
echo "Increment Test Failed"
exit 1;
fi;
if [[ "$http_code" == 200 ]];
then
echo "HTTP Status Code Test Passed"
else
echo "HTTP Status code is not 200"
exit 1;
fi;
else
echo "The Service does not have a NodePort"
exit 1;
fi;