Skip to content

Commit b68ed2a

Browse files
K8SPG-833_fix_test add stability (#1344)
* K8SPG-833_fix_test add stability * Apply suggestions from code review Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * fix --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
1 parent bd567da commit b68ed2a

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

e2e-tests/functions

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1036,16 +1036,22 @@ get_desired_replicas() {
10361036
kubectl get statefulset "$1" -n "$NAMESPACE" -o jsonpath='{.spec.replicas}'
10371037
}
10381038

1039+
get_ready_replicas() {
1040+
kubectl get sts "$1" -n "$NAMESPACE" -o jsonpath='{.status.readyReplicas}'
1041+
}
1042+
10391043
wait_sts_rollout() {
10401044
local sts=$1
1045+
local ready_replicas=$(get_ready_replicas $sts)
10411046
local updated_replicas=$(get_updated_replicas $sts)
10421047
local desired_replicas=$(get_desired_replicas $sts)
1048+
echo "ready_replicas $ready_replicas desired_replicas $desired_replicas"
10431049

1044-
until [[ $updated_replicas -eq $desired_replicas ]]; do
1045-
updated_replicas=$(get_updated_replicas $sts)
1050+
until [[ $ready_replicas -eq $desired_replicas && $updated_replicas -eq $desired_replicas ]]; do
1051+
ready_replicas=$(get_ready_replicas $sts)
10461052
desired_replicas=$(get_desired_replicas $sts)
1047-
1048-
echo "Waiting for sts/$sts to update... $updated_replicas/$desired_replicas pods updated."
1053+
updated_replicas=$(get_updated_replicas $sts)
1054+
echo "Waiting for sts/$sts to update... $ready_replicas/$updated_replicas/$desired_replicas pods updated."
10491055
sleep 10
10501056
done
10511057
}

0 commit comments

Comments
 (0)