forked from kodekloudhub/devsecops
-
Notifications
You must be signed in to change notification settings - Fork 0
/
integration-test-PROD.sh
39 lines (30 loc) · 954 Bytes
/
integration-test-PROD.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
#!/bin/bash
sleep 5s
# echo "ok"
# PORT=$(kubectl get svc ${serviceName} -o json | jq .spec.ports[].nodePort)
### Istio Ingress Gateway Port 80 - NodePort
PORT=$(kubectl -n istio-system get svc istio-ingressgateway -o json | jq '.spec.ports[] | select(.port == 80)' | jq .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;