Skip to content

Commit 53a18f2

Browse files
authored
improve testing nginx version after chart upgrade (#490)
1 parent 2da2fcd commit 53a18f2

File tree

1 file changed

+28
-1
lines changed

1 file changed

+28
-1
lines changed

e2e/scripts/check-postupgrade-state.sh

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,33 @@ wait_for_installation() {
2525
done
2626
}
2727

28+
function retry() {
29+
local retries=$1
30+
shift
31+
32+
local count=0
33+
until "$@"; do
34+
exit=$?
35+
wait=$((2 ** $count))
36+
count=$(($count + 1))
37+
if [ $count -lt $retries ]; then
38+
echo "Retry $count/$retries exited $exit, retrying in $wait seconds..."
39+
sleep $wait
40+
else
41+
echo "Retry $count/$retries exited $exit, no more retries left."
42+
return $exit
43+
fi
44+
done
45+
return 0
46+
}
47+
48+
function check_nginx_version {
49+
if ! kubectl describe pod -n ingress-nginx | grep -q "4.9.1"; then
50+
return 1
51+
fi
52+
return 0
53+
}
54+
2855
main() {
2956
local installation_version=
3057
installation_version="$1"
@@ -75,7 +102,7 @@ main() {
75102
exit 1
76103
fi
77104
# ensure the new version made it into the pod
78-
if ! kubectl describe pod -n ingress-nginx | grep -q "4.9.1" ; then
105+
if ! retry 5 check_nginx_version ; then
79106
echo "4.9.1 not found in ingress-nginx pod"
80107
kubectl describe pod -n ingress-nginx
81108
exit 1

0 commit comments

Comments
 (0)