Commit 6a8d5e75 authored by Janet Kuo's avatar Janet Kuo

Add test for deployment rollover

parent f2b898a8
...@@ -1952,7 +1952,7 @@ func waitForDeploymentStatus(c *client.Client, ns, deploymentName string, desire ...@@ -1952,7 +1952,7 @@ func waitForDeploymentStatus(c *client.Client, ns, deploymentName string, desire
return false, fmt.Errorf("old RCs are not fully scaled down") return false, fmt.Errorf("old RCs are not fully scaled down")
} }
if deploymentutil.GetReplicaCountForRCs([]*api.ReplicationController{newRC}) != desiredUpdatedReplicas { if deploymentutil.GetReplicaCountForRCs([]*api.ReplicationController{newRC}) != desiredUpdatedReplicas {
return false, fmt.Errorf("new RCs is not fully scaled up") return false, fmt.Errorf("new RC is not fully scaled up")
} }
return true, nil return true, nil
} }
...@@ -1979,6 +1979,21 @@ func waitForEvents(c *client.Client, ns string, objOrRef runtime.Object, desired ...@@ -1979,6 +1979,21 @@ func waitForEvents(c *client.Client, ns string, objOrRef runtime.Object, desired
}) })
} }
// Waits for the number of events on the given object to be at least a desired count.
func waitForPartialEvents(c *client.Client, ns string, objOrRef runtime.Object, atLeastEventsCount int) error {
return wait.Poll(poll, 5*time.Minute, func() (bool, error) {
events, err := c.Events(ns).Search(objOrRef)
if err != nil {
return false, fmt.Errorf("error in listing events: %s", err)
}
eventsCount := len(events.Items)
if eventsCount >= atLeastEventsCount {
return true, nil
}
return false, nil
})
}
// FailedContainers inspects all containers in a pod and returns failure // FailedContainers inspects all containers in a pod and returns failure
// information for containers that have failed or been restarted. // information for containers that have failed or been restarted.
// A map is returned where the key is the containerID and the value is a // A map is returned where the key is the containerID and the value is a
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment