Fix test cases occasional failure (#647)

This commit is contained in:
Ta-Ching Chen
2018-04-26 14:39:16 +08:00
committed by GitHub
parent 0b34abcada
commit 6375819195
2 changed files with 9 additions and 5 deletions
+7 -3
View File
@@ -43,9 +43,13 @@ fi
getPodName() {
NS=$1
POD=$2
kubectl -n ${NS} get po -o jsonpath='{range .items[*]}{.metadata.name}{"\n"}{end}' \
# find pod is ready to serve
JSONPATH="{range .items[*]}{'\n'}{@.metadata.name}:{range @.status.conditions[*]}{@.type}={@.status};{end}{end}"
kubectl -n ${NS} get po -o jsonpath="$JSONPATH" \
| grep "Ready=True" \
| grep ${POD} \
| head -n 1
| head -n 1 \
| cut -f1 -d":"
}
# retry function adapted from:
@@ -53,7 +57,7 @@ getPodName() {
function retry {
local n=1
local max=5
local delay=5
local delay=10 # pods take time to get ready
while true; do
"$@" && break || {
if [[ ${n} -lt ${max} ]]; then
+2 -2
View File
@@ -30,7 +30,7 @@ response=$(curl http://$FISSION_ROUTER/$fn)
log "Checking for valid response"
echo $response | grep -i hello
# crappy cleanup, improve this later
kubectl get httptrigger -o name | tail -1 | cut -f2 -d'/' | xargs kubectl delete httptrigger
routeid=$(fission route list|grep "$fn"|awk '{print $1}')
fission route delete --name $routeid || true
log "All done."