mirror of
https://github.com/optim-enterprises-bv/kubernetes.git
synced 2025-11-02 03:08:15 +00:00
e2e: simplify test cleanup
ginkgo.DeferCleanup has multiple advantages: - The cleanup operation can get registered if and only if needed. - No need to return a cleanup function that the caller must invoke. - Automatically determines whether a context is needed, which will simplify the introduction of context parameters. - Ginkgo's timeline shows when it executes the cleanup operation.
This commit is contained in:
@@ -594,7 +594,7 @@ var _ = SIGDescribe("POD Resources [Serial] [Feature:PodResources][NodeFeature:P
|
||||
|
||||
configMap := getSRIOVDevicePluginConfigMap(framework.TestContext.SriovdpConfigMapFile)
|
||||
sd := setupSRIOVConfigOrFail(f, configMap)
|
||||
defer teardownSRIOVConfigOrFail(f, sd)
|
||||
ginkgo.DeferCleanup(teardownSRIOVConfigOrFail, f, sd)
|
||||
|
||||
waitForSRIOVResources(f, sd)
|
||||
|
||||
@@ -623,7 +623,7 @@ var _ = SIGDescribe("POD Resources [Serial] [Feature:PodResources][NodeFeature:P
|
||||
|
||||
configMap := getSRIOVDevicePluginConfigMap(framework.TestContext.SriovdpConfigMapFile)
|
||||
sd := setupSRIOVConfigOrFail(f, configMap)
|
||||
defer teardownSRIOVConfigOrFail(f, sd)
|
||||
ginkgo.DeferCleanup(teardownSRIOVConfigOrFail, f, sd)
|
||||
|
||||
waitForSRIOVResources(f, sd)
|
||||
|
||||
@@ -762,7 +762,7 @@ var _ = SIGDescribe("POD Resources [Serial] [Feature:PodResources][NodeFeature:P
|
||||
|
||||
ginkgo.It("should return proper podresources the same as before the restart of kubelet", func(ctx context.Context) {
|
||||
dpPod := setupKubeVirtDevicePluginOrFail(f)
|
||||
defer teardownKubeVirtDevicePluginOrFail(f, dpPod)
|
||||
ginkgo.DeferCleanup(teardownKubeVirtDevicePluginOrFail, f, dpPod)
|
||||
|
||||
waitForKubeVirtResources(f, dpPod)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user