-
Notifications
You must be signed in to change notification settings - Fork 7
/
testMinikubeEnv.sh
executable file
·70 lines (55 loc) · 2.55 KB
/
testMinikubeEnv.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/bin/bash
function timer()
{
if [[ $# -eq 0 ]]; then
echo $(date '+%s')
else
local stime=$1
etime=$(date '+%s')
if [[ -z "$stime" ]]; then stime=$etime; fi
dt=$((etime - stime))
ds=$((dt % 60))
dm=$(((dt / 60) % 60))
dh=$((dt / 3600))
printf '%d:%02d:%02d' $dh $dm $ds
fi
}
startTime=$(timer)
ingressIP=$(minikube ip)
ingressPort=$(kubectl -n istio-system get svc istio-ingressgateway -o 'jsonpath={.spec.ports[0].nodePort}'); echo ""
echo "simple etcd test"
curl -v http://$ingressIP:32012/v2/keys/etcdDirect -XPUT -d value="simple etcd test"; echo ""
echo "-------------------------------"
echo "simple ping test"
curl -v http://$ingressIP:32380/; echo ""
echo "-------------------------------"
echo "test etcd service API call from node app"
curl -v http://$ingressIP:32380/storage -H "Content-Type: application/json" -XPUT -d '{"key": "istioTestNode", "value":"Testing Istio using NodePort"}'; echo ""
curl -v http://$ingressIP:32380/storage/istioTestNode; echo ""
echo "-------------------------------"
echo "simple hello test"
curl -v http://$ingressIP:$ingressPort/; echo ""
echo "-------------------------------"
echo "test etcd service API call using ingress"
curl -v http://$ingressIP:$ingressPort/storage -H "Content-Type: application/json" -XPUT -d '{"key": "istioTestIngress", "value":"Testing Istio using Ingress"}'; echo ""
curl -v http://$ingressIP:$ingressPort/storage/istioTestIngress; echo ""
echo "-------------------------------"
CLIENT=$(kubectl get pod -l app=proxy-etcd-storage -o jsonpath='{.items[0].metadata.name}')
SERVER=$(kubectl get pod -l app=etcd -o jsonpath='{.items[0].metadata.name}')
#Search the client logs for the API calls to etcd.
echo "client logs from istio-proxy"
kubectl logs $CLIENT istio-proxy | grep /v2/keys
echo "server logs from istio-proxy"
kubectl logs $SERVER istio-proxy | grep /v2/keys
echo "-------------------------------"
# Simple load test using loadtest (https://www.npmjs.com/package/loadtest)
if [ -x "$(command -v loadtest)" ]; then
loadtest -n 4000 -c 10 --rps 50 http://$ingressIP:$ingressPort/storage/istioTestIngress; echo ""
echo "-------------------------------"
loadtest -n 4000 -c 10 --rps 50 http://$ingressIP:$ingressPort/storage/istioTestIngress; echo ""
echo "-------------------------------"
loadtest -n 4000 -c 10 --rps 50 http://$ingressIP:$ingressPort/storage/istioTestIngress; echo ""
echo "-------------------------------"
fi
endTime=$(timer startTime)
printf 'testMinikubeEnv Elapsed time: %s\n' $endTime