Skip to content

Commit

Permalink
Merge pull request kubernetes#4421 from brendandburns/docs
Browse files Browse the repository at this point in the history
Add some retry to envvar log gathering.
  • Loading branch information
brendandburns committed Feb 14, 2015
2 parents 1cc9a27 + a2beba5 commit 200ef91
Showing 1 changed file with 18 additions and 10 deletions.
28 changes: 18 additions & 10 deletions test/e2e/pods.go
Original file line number Diff line number Diff line change
Expand Up @@ -323,16 +323,24 @@ var _ = Describe("Pods", func() {
}
By(fmt.Sprintf("Trying to get logs from host %s pod %s container %s: %v",
clientPodStatus.Status.Host, clientPodStatus.Name, clientPodStatus.Spec.Containers[0].Name, err))
logs, err := c.Get().
Prefix("proxy").
Resource("minions").
Name(clientPodStatus.Status.Host).
Suffix("containerLogs", api.NamespaceDefault, clientPodStatus.Name, clientPodStatus.Spec.Containers[0].Name).
Do().
Raw()
if err != nil {
Fail(fmt.Sprintf("Failed to get logs from host %s pod %s container %s: %v",
clientPodStatus.Status.Host, clientPodStatus.Name, clientPodStatus.Spec.Containers[0].Name, err))
var logs []byte
start := time.Now()
// Sometimes the actual containers take a second to get started, try to get logs for 60s
for time.Now().Sub(start) < (60 * time.Second) {
logs, err = c.Get().
Prefix("proxy").
Resource("minions").
Name(clientPodStatus.Status.Host).
Suffix("containerLogs", api.NamespaceDefault, clientPodStatus.Name, clientPodStatus.Spec.Containers[0].Name).
Do().
Raw()
if err != nil {
By(fmt.Sprintf("Failed to get logs from host %s pod %s container %s: %v",
clientPodStatus.Status.Host, clientPodStatus.Name, clientPodStatus.Spec.Containers[0].Name, err))
time.Sleep(5 * time.Second)
continue
}
break
}
fmt.Sprintf("clientPod logs:%v\n", string(logs))

Expand Down

0 comments on commit 200ef91

Please sign in to comment.