add some buff for pod initial restart count that is not zero

This commit is contained in:
Paco Xu 2023-03-02 17:01:38 +08:00
parent efee9b4866
commit e2b1050516

View File

@ -970,7 +970,9 @@ func RunLivenessTest(ctx context.Context, f *framework.Framework, pod *v1.Pod, e
framework.Logf("Initial restart count of pod %s is %d", pod.Name, initialRestartCount) framework.Logf("Initial restart count of pod %s is %d", pod.Name, initialRestartCount)
// Wait for the restart state to be as desired. // Wait for the restart state to be as desired.
deadline := time.Now().Add(timeout) // If initialRestartCount is not zero, there is restarting back-off time.
deadline := time.Now().Add(timeout + time.Duration(initialRestartCount)*10*time.Second)
lastRestartCount := initialRestartCount lastRestartCount := initialRestartCount
observedRestarts := int32(0) observedRestarts := int32(0)
for start := time.Now(); time.Now().Before(deadline); time.Sleep(2 * time.Second) { for start := time.Now(); time.Now().Before(deadline); time.Sleep(2 * time.Second) {