@@ -34,10 +34,33 @@ function cpusoaker_next_replica_count() {
34
34
fi
35
35
}
36
36
37
- function cpusoaker_test() {
37
+ function cpusoaker_test_1() {
38
+ local runtime=${1:- }
39
+ counter=0
38
40
local -i ____cpusoaker_current_replica_index=0
39
41
local -i ____cpusoaker_current_replicas=0
40
42
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() {
41
64
local default_job_runtime=$1
42
65
if (( ___cpusoaker_replica_increment < 1 )) ; then
43
66
echo " Replica increment must be at least 1" 1>&2
@@ -47,47 +70,20 @@ function cpusoaker_test() {
47
70
___cpusoaker_job_runtime=$default_job_runtime
48
71
fi
49
72
___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=()
56
74
local runtime
57
75
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 "
78
81
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
87
82
fi
88
83
done
89
84
}
90
85
86
+
91
87
function cpusoaker_process_option() {
92
88
local opt=$1
93
89
read -r noptname1 noptname optvalue <<< " $(parse_option " $opt " )"
0 commit comments