Skip to content

Commit 656ceff

Browse files
test(e2e): address review feedback on alluxio-scaledown test.sh
Simplify wait_dataset_bound's elapsed-time tracking to a single counter (matches wait_worker_replicas), and declare succeed/job_failed as local in wait_job_completed to avoid polluting global scope.
1 parent e346b16 commit 656ceff

1 file changed

Lines changed: 12 additions & 12 deletions

File tree

  • test/gha-e2e/alluxio-scaledown

test/gha-e2e/alluxio-scaledown/test.sh

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -53,23 +53,21 @@ function create_dataset() {
5353
function wait_dataset_bound() {
5454
local deadline=300 # 5 minutes
5555
local last_state=""
56-
local log_interval=0
57-
local log_times=0
56+
local counter=0
5857
while true; do
5958
last_state=$(kubectl get dataset $dataset_name -ojsonpath='{@.status.phase}')
60-
if [[ $log_interval -eq 3 ]]; then
61-
log_times=$((log_times + 1))
62-
syslog "checking dataset.status.phase==Bound (already $((log_times * log_interval * 5))s, last state: $last_state)"
63-
if [[ $((log_times * log_interval * 5)) -ge $deadline ]]; then
64-
panic "timeout for ${deadline}s!"
65-
fi
66-
log_interval=0
67-
fi
68-
6959
if [[ "$last_state" == "Bound" ]]; then
7060
break
7161
fi
72-
log_interval=$((log_interval + 1))
62+
63+
if [[ $((counter % 3)) -eq 0 ]]; then
64+
syslog "checking dataset.status.phase==Bound (already $((counter * 5))s, last state: $last_state)"
65+
fi
66+
67+
counter=$((counter + 1))
68+
if [[ $((counter * 5)) -ge $deadline ]]; then
69+
panic "timeout for ${deadline}s!"
70+
fi
7371
sleep 5
7472
done
7573
syslog "Found dataset $dataset_name status.phase==Bound"
@@ -123,6 +121,8 @@ function wait_job_completed() {
123121
local job_name=$1
124122
local deadline=300
125123
local counter=0
124+
local succeed=""
125+
local job_failed=""
126126
while true; do
127127
succeed=$(kubectl get job "$job_name" -ojsonpath='{@.status.succeeded}')
128128
[[ -z "$succeed" ]] && succeed=0

0 commit comments

Comments
 (0)