@@ -784,6 +784,7 @@ func validateController(c *client.Client, containerImage string, replicas int, c
784784 getImageTemplate := fmt .Sprintf (`--template={{if (exists . "status" "containerStatuses")}}{{range .status.containerStatuses}}{{if eq .name "%s"}}{{.image}}{{end}}{{end}}{{end}}` , containername )
785785
786786 By (fmt .Sprintf ("waiting for all containers in %s pods to come up." , testname )) //testname should be selector
787+ waitLoop:
787788 for start := time .Now (); time .Since (start ) < podStartTimeout ; time .Sleep (5 * time .Second ) {
788789 getPodsOutput := runKubectl ("get" , "pods" , "-o" , "template" , getPodsTemplate , "--api-version=v1" , "-l" , testname , fmt .Sprintf ("--namespace=%v" , ns ))
789790 pods := strings .Fields (getPodsOutput )
@@ -796,20 +797,20 @@ func validateController(c *client.Client, containerImage string, replicas int, c
796797 running := runKubectl ("get" , "pods" , podID , "-o" , "template" , getContainerStateTemplate , "--api-version=v1" , fmt .Sprintf ("--namespace=%v" , ns ))
797798 if running != "true" {
798799 Logf ("%s is created but not running" , podID )
799- continue
800+ continue waitLoop
800801 }
801802
802803 currentImage := runKubectl ("get" , "pods" , podID , "-o" , "template" , getImageTemplate , "--api-version=v1" , fmt .Sprintf ("--namespace=%v" , ns ))
803804 if currentImage != containerImage {
804805 Logf ("%s is created but running wrong image; expected: %s, actual: %s" , podID , containerImage , currentImage )
805- continue
806+ continue waitLoop
806807 }
807808
808809 // Call the generic validator function here.
809810 // This might validate for example, that (1) getting a url works and (2) url is serving correct content.
810811 if err := validator (c , podID ); err != nil {
811812 Logf ("%s is running right image but validator function failed: %v" , podID , err )
812- continue
813+ continue waitLoop
813814 }
814815
815816 Logf ("%s is verified up and running" , podID )
@@ -1252,11 +1253,12 @@ func waitForRCPodsRunning(c *client.Client, ns, rcName string) error {
12521253 label := labels .SelectorFromSet (labels .Set (map [string ]string {"name" : rcName }))
12531254 podStore := newPodStore (c , ns , label , fields .Everything ())
12541255 defer podStore .Stop ()
1256+ waitLoop:
12551257 for start := time .Now (); time .Since (start ) < 10 * time .Minute ; time .Sleep (5 * time .Second ) {
12561258 pods := podStore .List ()
12571259 for _ , p := range pods {
12581260 if p .Status .Phase != api .PodRunning {
1259- continue
1261+ continue waitLoop
12601262 }
12611263 }
12621264 running = true
0 commit comments