Skip to content

Commit

Permalink
test: fix Infinite loop during VM provisioning
Browse files Browse the repository at this point in the history
Fixes: #16871

Signed-off-by: Gaurav Genani <h3llix.pvt@gmail.com>
  • Loading branch information
h3llix committed Aug 11, 2021
1 parent 2d075ea commit 9ab98fe
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
4 changes: 4 additions & 0 deletions jenkinsfiles/kubernetes-upstream.Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,10 @@ pipeline {
timeout(time: 150, unit: 'MINUTES')
}

environment {
POLL_TIMEOUT_SECONDS=300
}

steps {
sh 'cd ${TESTDIR}; vagrant ssh k8s1-${K8S_VERSION} -c "cd /home/vagrant/go/${PROJ_PATH}; sudo ./test/kubernetes-test.sh ${DOCKER_TAG}"'
}
Expand Down
20 changes: 12 additions & 8 deletions test/kubernetes-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,20 @@ helm template --validate install/kubernetes/cilium \

kubectl apply -f cilium.yaml

while true; do
result=$(kubectl -n kube-system get pods -l k8s-app=cilium | grep "Running" -c)
echo "Running pods ${result}"
if [ "${result}" == "2" ]; then
runningPods="0"

echo "result match, continue with kubernetes"
break
fi
pollCiliumPods () {
until [ "${runningPods}" == "2" ]; do
runningPods=$(kubectl -n kube-system get pods -l k8s-app=cilium | grep "Running" -c)
echo "Running Pods ${runningPods}"
sleep 1
done
done
echo "result match, continue with kubernetes"
}

export -f pollCiliumPods
timeout ${POLL_TIMEOUT_SECONDS} bash -c pollCiliumPods
unset pollCiliumPods

set -e

Expand Down

0 comments on commit 9ab98fe

Please sign in to comment.