Skip to content

Commit

Permalink
Merge pull request #190 from ty-dc/fix/fix
Browse files Browse the repository at this point in the history
fix cancelled Context reuse
  • Loading branch information
weizhoublue authored Dec 18, 2023
2 parents a5f325a + 7f243f9 commit 1c8a58f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions framework/pod.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ func (f *Framework) WaitPodStarted(name, namespace string, ctx context.Context)
select {
case <-ctx.Done():
f.Log("pod %s/%s is still in phase %s \n", namespace, name, pod.Status.Phase)
podEvents, err := f.GetEvents(ctx, "Pod", name, namespace)
podEvents, err := f.GetEvents(context.Background(), "Pod", name, namespace)
if nil == err {
for _, item := range podEvents.Items {
f.Log("pod %s/%s events: %s\n", namespace, name, item.String())
Expand All @@ -111,15 +111,15 @@ func (f *Framework) WaitPodStarted(name, namespace string, ctx context.Context)
pod, err := f.GetPod(name, namespace)
if nil != err {
if errors.IsNotFound(err) {
time.Sleep(time.Second)
time.Sleep(3 * time.Second)
continue
}
return nil, err
}
if pod.Status.Phase == corev1.PodRunning {
return pod, nil
}
time.Sleep(time.Second)
time.Sleep(3 * time.Second)
}
}
}
Expand Down Expand Up @@ -147,7 +147,7 @@ func (f *Framework) WaitPodListDeleted(namespace string, label map[string]string
} else if len(podlist.Items) == 0 {
return nil
}
time.Sleep(time.Second)
time.Sleep(3 * time.Second)
}
}
}
Expand Down

0 comments on commit 1c8a58f

Please sign in to comment.