Skip to content

Commit d3c0baf

Browse files
committedMar 13, 2023
Run cpusoaker with runtimeclasses in the outer loop.
Fixes regression from 1.1-ci. This is needed to ensure that memory measurements from a prior kata run don't result in false results for the next runc run.

File tree

1 file changed

+31
-35
lines changed

1 file changed

+31
-35
lines changed
 

‎lib/clusterbuster/CI/workloads/cpusoaker.workload

Lines changed: 31 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,33 @@ function cpusoaker_next_replica_count() {
3434
fi
3535
}
3636

37-
function cpusoaker_test() {
37+
function cpusoaker_test_1() {
38+
local runtime=${1:-}
39+
counter=0
3840
local -i ____cpusoaker_current_replica_index=0
3941
local -i ____cpusoaker_current_replicas=0
4042
local -i replicas=0
43+
if ((___cpusoaker_starting_replicas > 0)) ; then
44+
____cpusoaker_current_replicas=$___cpusoaker_starting_replicas
45+
else
46+
____cpusoaker_current_replicas=$___cpusoaker_replica_increment
47+
fi
48+
while cpusoaker_next_replica_count ; do
49+
local xruntime=$runtime
50+
if [[ $xruntime = runc ]] ; then xruntime=''; fi
51+
job_name="$replicas"
52+
run_clusterbuster_1 -r "$xruntime" -y -j "$job_name" -w cpusoaker \
53+
-t "$___cpusoaker_job_timeout" -R "$___cpusoaker_job_runtime" -- \
54+
--replicas="$replicas" --failure-status='No Result' \
55+
--cleanup-always=1 || return
56+
counter=$((counter+1))
57+
if ((debugonly && counter > 10)) ; then
58+
break
59+
fi
60+
done
61+
}
62+
63+
function cpusoaker_test() {
4164
local default_job_runtime=$1
4265
if ((___cpusoaker_replica_increment < 1)) ; then
4366
echo "Replica increment must be at least 1" 1>&2
@@ -47,47 +70,20 @@ function cpusoaker_test() {
4770
___cpusoaker_job_runtime=$default_job_runtime
4871
fi
4972
___cpusoaker_job_timeout=$(compute_timeout "$___cpusoaker_job_timeout")
50-
if ((___cpusoaker_starting_replicas > 0)) ; then
51-
____cpusoaker_current_replicas=$___cpusoaker_starting_replicas
52-
else
53-
____cpusoaker_current_replicas=$___cpusoaker_replica_increment
54-
fi
55-
local -A runtimes_to_test=()
73+
local -A runtimes_tested=()
5674
local runtime
5775
for runtime in "${runtimeclasses[@]}" ; do
58-
if [[ -z "$runtime" || $runtime = runc ]] || oc get runtimeclass "$runtime" >/dev/null 2>&1 ; then
59-
runtime=${runtime:-runc}
60-
runtimes+=("$runtime")
61-
runtimes_to_test[$runtime]=1
62-
fi
63-
done
64-
while cpusoaker_next_replica_count ; do
65-
for runtime in "${runtimes[@]}" ; do
66-
if [[ -n "${runtimes_to_test[$runtime]:-}" ]] ; then
67-
local xruntime=$runtime
68-
if [[ $xruntime = runc ]] ; then xruntime=''; fi
69-
job_name="$replicas"
70-
if run_clusterbuster_1 -r "$xruntime" -y -j "$job_name" -w cpusoaker \
71-
-t "$___cpusoaker_job_timeout" -R "$___cpusoaker_job_runtime" -- \
72-
--replicas="$replicas" --failure-status='No Result' \
73-
--cleanup-always=1 ; then
74-
:
75-
else
76-
unset runtimes_to_test[$runtime]
77-
fi
76+
runtime=${runtime:-runc}
77+
if [[ -z "${runtimes_tested[${runtime}]:-}" ]] ; then
78+
if [[ $runtime = runc ]] || oc get runtimeclass "$runtime" >/dev/null 2>&1 ; then
79+
runtimes_tested[$runtime]=1
80+
cpusoaker_test_1 "$runtime"
7881
fi
79-
done
80-
if [[ -n "${runtimes_to_test[*]}" ]] ; then
81-
counter=$((counter+1))
82-
else
83-
break
84-
fi
85-
if ((debugonly && counter > 10)) ; then
86-
break
8782
fi
8883
done
8984
}
9085

86+
9187
function cpusoaker_process_option() {
9288
local opt=$1
9389
read -r noptname1 noptname optvalue <<< "$(parse_option "$opt")"

0 commit comments

Comments
 (0)
Please sign in to comment.