Skip to content

Commit 6337a28

Browse files
committed
Organize into its own context
Signed-off-by: Laura Lorenz <[email protected]>
1 parent f913b7a commit 6337a28

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

test/e2e_node/criproxy_test.go

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,20 @@ var _ = SIGDescribe(feature.CriProxy, framework.WithSerial(), func() {
8282
isExpectedErrMsg := strings.Contains(eventMsg, expectedErr.Error())
8383
gomega.Expect(isExpectedErrMsg).To(gomega.BeTrueBecause("we injected an exception into the PullImage interface of the cri proxy"))
8484
})
85+
})
86+
87+
ginkgo.Context("Inject a pull image error exception, then reset it, into the CriProxy", func() {
88+
ginkgo.BeforeEach(func() {
89+
if err := resetCRIProxyInjector(); err != nil {
90+
ginkgo.Skip("Skip the test since the CRI Proxy is undefined.")
91+
}
92+
})
93+
94+
ginkgo.AfterEach(func() {
95+
err := resetCRIProxyInjector()
96+
framework.ExpectNoError(err)
97+
})
98+
8599
ginkgo.It("Image pull retry backs off on error.", func(ctx context.Context) {
86100
expectedErr := fmt.Errorf("PullImage failed")
87101
err := addCRIProxyInjector(func(apiName string) error {
@@ -107,7 +121,7 @@ var _ = SIGDescribe(feature.CriProxy, framework.WithSerial(), func() {
107121
gomega.Expect(isExpectedErrMsg).To(gomega.BeTrueBecause("we injected an exception into the PullImage interface of the cri proxy"))
108122

109123
// remove error so after backoff we will succeed
110-
resetCRIProxyInjector()
124+
_ = resetCRIProxyInjector()
111125

112126
podErr = e2epod.WaitForPodRunningInNamespace(ctx, f.ClientSet, pod)
113127
framework.ExpectNoError(podErr)
@@ -189,11 +203,13 @@ func getImageBackOffDurations(ctx context.Context, f *framework.Framework, podNa
189203
var r *BackOffRecord
190204
for _, event := range events.Items {
191205
if event.InvolvedObject.Name == podName {
206+
192207
switch event.Reason {
193208
case kubeletevents.PullingImage:
194209
if !pullTime.IsZero() {
195210
if event.FirstTimestamp.Time.After(pullTime) {
196211
r = records[backoffCount]
212+
r.podName = podName
197213
r.duration = r.initialEventTime.Sub(r.backoffEventTimes[len(r.backoffEventTimes)-1])
198214
backoffs = append(backoffs, r.duration)
199215
backoffCount++

0 commit comments

Comments
 (0)