Merge pull request #10345 from wojtek-t/increase_rc_timeout

Increase timeout for waiting for pods running in load test
This commit is contained in:
Maxwell Forbes 2015-06-25 10:00:05 -07:00
commit 8b0efe8b85
2 changed files with 7 additions and 1 deletions

View File

@ -157,6 +157,7 @@ func generateRCConfigsForGroup(c *client.Client, ns, groupName string, size, cou
Client: c, Client: c,
Name: groupName + "-" + strconv.Itoa(i), Name: groupName + "-" + strconv.Itoa(i),
Namespace: ns, Namespace: ns,
Timeout: 10 * time.Minute,
Image: image, Image: image,
Replicas: size, Replicas: size,
} }

View File

@ -157,6 +157,7 @@ type RCConfig struct {
Name string Name string
Namespace string Namespace string
PollInterval time.Duration PollInterval time.Duration
Timeout time.Duration
PodStatusFile *os.File PodStatusFile *os.File
Replicas int Replicas int
@ -966,10 +967,14 @@ func RunRC(config RCConfig) error {
if interval <= 0 { if interval <= 0 {
interval = 10 * time.Second interval = 10 * time.Second
} }
timeout := config.Timeout
if timeout <= 0 {
timeout = 5 * time.Minute
}
oldPods := make([]*api.Pod, 0) oldPods := make([]*api.Pod, 0)
oldRunning := 0 oldRunning := 0
lastChange := time.Now() lastChange := time.Now()
for oldRunning != config.Replicas && time.Since(lastChange) < 5*time.Minute { for oldRunning != config.Replicas && time.Since(lastChange) < timeout {
time.Sleep(interval) time.Sleep(interval)
running := 0 running := 0