Skip to content

Commit

Permalink
Merge pull request kubernetes#1790 from jbeda/1678-fix-e2e
Browse files Browse the repository at this point in the history
Deal with the case where a pod goes away after we list it.
  • Loading branch information
lavalamp committed Oct 15, 2014
2 parents 2987747 + 391335c commit 180e90f
Showing 1 changed file with 27 additions and 2 deletions.
29 changes: 27 additions & 2 deletions hack/e2e-suite/update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,34 @@ function validate() {
num_running=0
for id in "${pod_id_list[@]+${pod_id_list[@]}}"; do
local template_string current_status current_image host_ip

# NB: This template string is a little subtle.
#
# Notes:
#
# The 'and' operator will return blank if any of the inputs are non-
# nil/false. If they are all set, then it'll return the last one.
#
# The container is name has a dash in it and so we can't use the simple
# syntax. Instead we need to quote that and use the 'index' operator.
#
# The value here is a structure with just a Time member. This is
# currently always set to a zero time.
#
# You can read about the syntax here: http://golang.org/pkg/text/template/
template_string="{{and ((index .CurrentState.Info \"${CONTROLLER_NAME}\").State.Running) .CurrentState.Info.net.State.Running}}"
current_status=$($KUBECFG -template="${template_string}" get "pods/$id")
if [ "$current_status" != "{0001-01-01 00:00:00 +0000 UTC}" ]; then
current_status=$($KUBECFG -template="${template_string}" get "pods/$id") || {
if [[ $current_status =~ "pod \"${id}\" not found" ]]; then
echo " $id no longer exists"
continue
else
echo " kubecfg failed with error:"
echo $current_status
exit -1
fi
}

if [[ "$current_status" != "{0001-01-01 00:00:00 +0000 UTC}" ]]; then
echo " $id is created but not running"
continue
fi
Expand Down

0 comments on commit 180e90f

Please sign in to comment.