@@ -27,6 +27,7 @@ import (
27
27
28
28
"github.com/onsi/ginkgo/v2"
29
29
"github.com/onsi/gomega"
30
+ "github.com/pkg/errors"
30
31
kubeletconfig "k8s.io/kubernetes/pkg/kubelet/apis/config"
31
32
32
33
v1 "k8s.io/api/core/v1"
@@ -59,7 +60,7 @@ var _ = SIGDescribe("Container Restart", feature.CriProxy, framework.WithSerial(
59
60
60
61
ginkgo .It ("Container restart backs off." , func (ctx context.Context ) {
61
62
// 0s, 0s, 10s, 30s, 70s, 150s, 310s
62
- doTest (ctx , f , 5 , containerName , 7 )
63
+ doTest (ctx , f , 3 , containerName , 7 )
63
64
})
64
65
})
65
66
@@ -82,8 +83,8 @@ var _ = SIGDescribe("Container Restart", feature.CriProxy, framework.WithSerial(
82
83
})
83
84
84
85
ginkgo .It ("Alternate restart backs off." , func (ctx context.Context ) {
85
- // 0s, 0s, 10s, 30s, 60s, 90s, 120s, 150, 180, 210)
86
- doTest (ctx , f , 7 , containerName , 10 )
86
+ // 0s, 0s, 10s, 30s, 60s, 90s, 120s, 150s, 180s, 210s, 240s, 270s, 300s
87
+ doTest (ctx , f , 3 , containerName , 13 )
87
88
})
88
89
})
89
90
})
@@ -94,8 +95,9 @@ func doTest(ctx context.Context, f *framework.Framework, targetRestarts int, con
94
95
podErr := e2epod .WaitForPodContainerToFail (ctx , f .ClientSet , f .Namespace .Name , pod .Name , 0 , "CrashLoopBackOff" , 1 * time .Minute )
95
96
gomega .Expect (podErr ).To (gomega .HaveOccurred ())
96
97
97
- // Wait for 210s worth of backoffs to occur so we can confirm the backoff growth.
98
- podErr = e2epod .WaitForContainerRestartedNTimes (ctx , f .ClientSet , f .Namespace .Name , pod .Name , containerName , 210 * time .Second , targetRestarts )
98
+ // Hard wait 30 seconds for targetRestarts in the best case; longer timeout later will handle if infra was slow.
99
+ time .Sleep (30 * time .Second )
100
+ podErr = e2epod .WaitForContainerRestartedNTimes (ctx , f .ClientSet , f .Namespace .Name , pod .Name , containerName , 5 * time .Minute , targetRestarts )
99
101
gomega .Expect (podErr ).ShouldNot (gomega .HaveOccurred (), "Expected container to repeatedly back off container failures" )
100
102
101
103
r , err := extractObservedBackoff (ctx , f , pod .Name , containerName )
@@ -117,7 +119,7 @@ func extractObservedBackoff(ctx context.Context, f *framework.Framework, podName
117
119
}
118
120
}
119
121
}
120
- return r , nil
122
+ return r , errors . Errorf ( "Could not find container status for container %s in pod %s" , containerName , podName )
121
123
}
122
124
123
125
func newFailAlwaysPod () * v1.Pod {
0 commit comments