mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-28 05:57:25 +00:00
fix pull image test flake
This commit is contained in:
parent
594e4d883c
commit
b5cef55af5
@ -261,14 +261,22 @@ while true; do sleep 1; done
|
|||||||
Expect(container.Create()).To(Succeed())
|
Expect(container.Create()).To(Succeed())
|
||||||
defer container.Delete()
|
defer container.Delete()
|
||||||
|
|
||||||
By("check the pod phase")
|
// We need to check container state first. The default pod status is pending, If we check
|
||||||
Eventually(container.GetPhase, retryTimeout, pollInterval).Should(Equal(testCase.phase))
|
// pod phase first, and the expected pod phase is Pending, the container status may not
|
||||||
Consistently(container.GetPhase, consistentCheckTimeout, pollInterval).Should(Equal(testCase.phase))
|
// even show up when we check it.
|
||||||
|
|
||||||
By("check the container state")
|
By("check the container state")
|
||||||
status, err := container.GetStatus()
|
getState := func() (ContainerState, error) {
|
||||||
Expect(err).NotTo(HaveOccurred())
|
status, err := container.GetStatus()
|
||||||
Expect(GetContainerState(status.State)).To(Equal(testCase.state))
|
if err != nil {
|
||||||
|
return ContainerStateUnknown, err
|
||||||
|
}
|
||||||
|
return GetContainerState(status.State), nil
|
||||||
|
}
|
||||||
|
Eventually(getState, retryTimeout, pollInterval).Should(Equal(testCase.state))
|
||||||
|
Consistently(getState, consistentCheckTimeout, pollInterval).Should(Equal(testCase.state))
|
||||||
|
|
||||||
|
By("check the pod phase")
|
||||||
|
Expect(container.GetPhase()).To(Equal(testCase.phase))
|
||||||
|
|
||||||
By("it should be possible to delete")
|
By("it should be possible to delete")
|
||||||
Expect(container.Delete()).To(Succeed())
|
Expect(container.Delete()).To(Succeed())
|
||||||
|
Loading…
Reference in New Issue
Block a user