mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-18 16:21:13 +00:00
Simplify DeferCleanup.
Co-authored-by: Patrick Ohly <patrick.ohly@intel.com>
This commit is contained in:
parent
b30720fc9f
commit
149f4878a7
@ -78,12 +78,7 @@ var _ = utils.SIGDescribe("StaticPods [Feature:Kind]", func() {
|
|||||||
}
|
}
|
||||||
pod, err := e2epod.CreateSecPod(ctx, f.ClientSet, podConfig, f.Timeouts.PodStart)
|
pod, err := e2epod.CreateSecPod(ctx, f.ClientSet, podConfig, f.Timeouts.PodStart)
|
||||||
framework.ExpectNoError(err, "Creating a pod with a CSI volume")
|
framework.ExpectNoError(err, "Creating a pod with a CSI volume")
|
||||||
ginkgo.DeferCleanup(func(ctx context.Context) {
|
ginkgo.DeferCleanup(f.ClientSet.CoreV1().Pods(f.Namespace.Name).Delete, pod.Name, metav1.DeleteOptions{})
|
||||||
if pod != nil {
|
|
||||||
err := f.ClientSet.CoreV1().Pods(f.Namespace.Name).Delete(ctx, pod.Name, metav1.DeleteOptions{})
|
|
||||||
framework.ExpectNoError(err, "Deleting the pod with the CSI volume")
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
ginkgo.By("Stop the control plane by removing the static pod manifests")
|
ginkgo.By("Stop the control plane by removing the static pod manifests")
|
||||||
err = stopControlPlane(ctx)
|
err = stopControlPlane(ctx)
|
||||||
|
Loading…
Reference in New Issue
Block a user