mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
testcluster: Handle short-lived pods in WaitForPodRunning.
Prior to this change, `WaitForPodRunning` was susceptible to a race condition whereby a short-lived pod could run and complete before the poll loop notices that its state has changed to "running". PiperOrigin-RevId: 707380314
This commit is contained in:
committed by
gVisor bot
parent
c87b16ccc8
commit
f34ef4e1f7
@@ -451,7 +451,9 @@ func (t *TestCluster) ReadPodLogs(ctx context.Context, pod *v13.Pod) (string, er
|
||||
|
||||
// WaitForPodRunning is a helper method to wait for a pod to be running.
|
||||
func (t *TestCluster) WaitForPodRunning(ctx context.Context, pod *v13.Pod) error {
|
||||
_, err := t.doWaitForPod(ctx, pod, func(p v13.PodPhase) bool { return p == v13.PodRunning })
|
||||
// We also accept pods in the PodSucceeded state, because short-lived pods
|
||||
// may have already ran and succeeded by the time we poll them.
|
||||
_, err := t.doWaitForPod(ctx, pod, func(p v13.PodPhase) bool { return p == v13.PodRunning || p == v13.PodSucceeded })
|
||||
return err
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user