mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-03 09:22:44 +00:00
Delete namespace after test
This commit is contained in:
parent
974377b306
commit
b96d2296b4
@ -39,6 +39,11 @@ func runLivenessTest(c *client.Client, podDescr *api.Pod, expectRestart bool) {
|
||||
namespace, err := createTestingNS("pods-liveness", c)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
ns := namespace.Name
|
||||
defer func() {
|
||||
if err := c.Namespaces().Delete(ns); err != nil {
|
||||
Failf("Couldn't delete ns %q: %s", namespace, err)
|
||||
}
|
||||
}()
|
||||
|
||||
By(fmt.Sprintf("Creating pod %s in namespace %s", podDescr.Name, ns))
|
||||
_, err = c.Pods(ns).Create(podDescr)
|
||||
@ -90,6 +95,11 @@ func testHostIP(c *client.Client, pod *api.Pod) {
|
||||
namespace, err := createTestingNS("pods-host-ip", c)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
ns := namespace.Name
|
||||
defer func() {
|
||||
if err := c.Namespaces().Delete(ns); err != nil {
|
||||
Failf("Couldn't delete ns %q: %s", namespace, err)
|
||||
}
|
||||
}()
|
||||
|
||||
podClient := c.Pods(ns)
|
||||
By("creating pod")
|
||||
|
Loading…
Reference in New Issue
Block a user