Fix test cases occasional failure (#647)
This commit is contained in:
@@ -43,9 +43,13 @@ fi
|
|||||||
getPodName() {
|
getPodName() {
|
||||||
NS=$1
|
NS=$1
|
||||||
POD=$2
|
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} \
|
| grep ${POD} \
|
||||||
| head -n 1
|
| head -n 1 \
|
||||||
|
| cut -f1 -d":"
|
||||||
}
|
}
|
||||||
|
|
||||||
# retry function adapted from:
|
# retry function adapted from:
|
||||||
@@ -53,7 +57,7 @@ getPodName() {
|
|||||||
function retry {
|
function retry {
|
||||||
local n=1
|
local n=1
|
||||||
local max=5
|
local max=5
|
||||||
local delay=5
|
local delay=10 # pods take time to get ready
|
||||||
while true; do
|
while true; do
|
||||||
"$@" && break || {
|
"$@" && break || {
|
||||||
if [[ ${n} -lt ${max} ]]; then
|
if [[ ${n} -lt ${max} ]]; then
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ response=$(curl http://$FISSION_ROUTER/$fn)
|
|||||||
log "Checking for valid response"
|
log "Checking for valid response"
|
||||||
echo $response | grep -i hello
|
echo $response | grep -i hello
|
||||||
|
|
||||||
# crappy cleanup, improve this later
|
routeid=$(fission route list|grep "$fn"|awk '{print $1}')
|
||||||
kubectl get httptrigger -o name | tail -1 | cut -f2 -d'/' | xargs kubectl delete httptrigger
|
fission route delete --name $routeid || true
|
||||||
|
|
||||||
log "All done."
|
log "All done."
|
||||||
|
|||||||
Reference in New Issue
Block a user