mirror of
https://github.com/kubernetes/kubernetes.git
synced 2026-02-03 20:40:26 -05:00
Fix container_restart_test AfterEach failing when CRI Proxy is undefined
Two test contexts were failing because their AfterEach blocks run even when BeforeEach skips the test (standard Ginkgo behavior). This caused resetCRIProxyInjector to fail with "CRI Proxy is undefined". Switched to using DeferCleanup inside BeforeEach instead, which only runs if BeforeEach succeeds. This is the same pattern the other test contexts in this file already use. Signed-off-by: Davanum Srinivas <davanum@gmail.com>
This commit is contained in:
parent
c7416f744e
commit
03e6622c92
1 changed files with 6 additions and 10 deletions
|
|
@ -100,11 +100,9 @@ var _ = SIGDescribe("Container Restart", feature.CriProxy, framework.WithSerial(
|
|||
if err := resetCRIProxyInjector(e2eCriProxy); err != nil {
|
||||
ginkgo.Skip("Skip the test since the CRI Proxy is undefined.")
|
||||
}
|
||||
})
|
||||
|
||||
ginkgo.AfterEach(func() {
|
||||
err := resetCRIProxyInjector(e2eCriProxy)
|
||||
framework.ExpectNoError(err)
|
||||
ginkgo.DeferCleanup(func() error {
|
||||
return resetCRIProxyInjector(e2eCriProxy)
|
||||
})
|
||||
})
|
||||
|
||||
ginkgo.It("Reduced default restart backs off.", func(ctx context.Context) {
|
||||
|
|
@ -128,11 +126,9 @@ var _ = SIGDescribe("Container Restart", feature.CriProxy, framework.WithSerial(
|
|||
if err := resetCRIProxyInjector(e2eCriProxy); err != nil {
|
||||
ginkgo.Skip("Skip the test since the CRI Proxy is undefined.")
|
||||
}
|
||||
})
|
||||
|
||||
ginkgo.AfterEach(func() {
|
||||
err := resetCRIProxyInjector(e2eCriProxy)
|
||||
framework.ExpectNoError(err)
|
||||
ginkgo.DeferCleanup(func() error {
|
||||
return resetCRIProxyInjector(e2eCriProxy)
|
||||
})
|
||||
})
|
||||
|
||||
ginkgo.It("Reduced default restart backs off.", func(ctx context.Context) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue