This repository was archived by the owner on Apr 27, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +14
-4
lines changed Expand file tree Collapse file tree 2 files changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -139,7 +139,7 @@ wait_until_pods_ready() {
139
139
140
140
echo " Waiting for pods to be ready for ${period} s (interval: ${interval} s, selector: ${selector:- ' ' } )"
141
141
142
- # The list of "<pod-name> <ready(True|False)>" which is excluded terminating and failed/succeeded pods.
142
+ # The list of "<pod-name> <ready(True|False|`null` )>" which is excluded terminating and failed/succeeded pods.
143
143
template=" $( cat << EOL
144
144
{{- range .items -}}
145
145
{{- if and (not .metadata.deletionTimestamp) (ne .status.phase "Failed") (ne .status.phase "Succeeded") -}}
154
154
sleep " $interval "
155
155
156
156
statuses=" $( kubectl get po --selector=" $selector " -o template --template=" $template " ) "
157
- not_ready=" $( echo " $statuses " | grep -c " False" || :) "
158
- ready=" $( echo " $statuses " | grep -c " True" || :) "
157
+ # Some pods don't have "Ready" condition, so we can't determine "not Ready" using "False".
158
+ not_ready=" $( echo -n " $statuses " | grep -v -c " True" || :) "
159
+ ready=" $( echo -n " $statuses " | grep -c " True" || :) "
159
160
160
161
echo " Waiting for pods to be ready... ($ready /$(( not_ready + ready)) )"
161
162
165
166
done
166
167
167
168
echo " Waited for ${period} s, but the following pods are not ready yet."
168
- echo " $statuses " | awk ' {if ($2 == "False ") print "- " $1}'
169
+ echo " $statuses " | awk ' {if ($2 != "True ") print "- " $1}'
169
170
return 1
170
171
}
171
172
Original file line number Diff line number Diff line change @@ -71,3 +71,12 @@ teardown() {
71
71
assert_not_equal " <no value>" " ${lines[0]} "
72
72
assert_success
73
73
}
74
+
75
+ @test " pending pod" {
76
+ # Request large resources, so that pod will fall into Pending state
77
+ run assets/out <<< " $(jq -n '{" source" : {" kubeconfig" : $kubeconfig }, " params" : {" kubectl" : $kubectl }}' \
78
+ --arg kubeconfig " $( cat " $kubeconfig_file " ) " \
79
+ --arg kubectl " run nginx --image nginx --requests=' cpu=1000' " )"
80
+ assert_match ' deployment.apps "nginx" created' " $output "
81
+ assert_failure
82
+ }
You can’t perform that action at this time.
0 commit comments