forked from kjarosh/agh-gmmf-prototype
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtests-queries.sh
executable file
·39 lines (31 loc) · 924 Bytes
/
tests-queries.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
set -e
COUNT_ZONES=${1}
ZONES=()
graph_path=${2:-./graph.json}
if [[ ! -f "$graph_path" ]]; then
echo "graph not found"
exit 1
fi
load_zones() {
for ((i = 0; i < COUNT_ZONES; i++)); do
newZone="$(kubectl get pod -l "zone=zone${i}" | grep -w Running | awk '{print $1;}')"
ZONES+=("${newZone}")
done
}
clear_redis() {
kubectl exec -it "$1" -- redis-cli FLUSHALL
}
clear_redises() {
for ((i = 0; i < COUNT_ZONES; i++)); do
clear_redis "${ZONES[i]}" &
done
wait
}
load_zones
clear_redises
kubectl exec -it "${ZONES[COUNT_ZONES - 1]}" -- bash -c "rm -f ./queriesResults.json"
kubectl cp "$graph_path" ${ZONES[COUNT_ZONES - 1]}:/graph.json
kubectl cp ./queries_caller.sh ${ZONES[COUNT_ZONES - 1]}:/queries_caller.sh
kubectl exec -it "${ZONES[COUNT_ZONES - 1]}" -- bash -c "chmod 777 ./queries_caller.sh"
kubectl exec -it "${ZONES[COUNT_ZONES - 1]}" -- bash -c "./queries_caller.sh"