From f661786114e6f35a06a87d797dabee93bf0b9a13 Mon Sep 17 00:00:00 2001 From: Satyajit Behera <105061492+satyazzz123@users.noreply.github.com> Date: Fri, 3 Nov 2023 01:26:29 +0530 Subject: [PATCH] test/e2e: NamespacedTest helper can create/delete multiple namespaces (#5928) Signed-off-by: satyazzz123 --- test/e2e/framework.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/test/e2e/framework.go b/test/e2e/framework.go index 2bb9f028341..999f439b848 100644 --- a/test/e2e/framework.go +++ b/test/e2e/framework.go @@ -283,13 +283,17 @@ type NamespacedGatewayTestBody func(ns string, gw types.NamespacedName) type NamespacedTestBody func(string) type TestBody func() -func (f *Framework) NamespacedTest(namespace string, body NamespacedTestBody) { +func (f *Framework) NamespacedTest(namespace string, body NamespacedTestBody, additionalNamespaces ...string) { ginkgo.Context("with namespace: "+namespace, func() { ginkgo.BeforeEach(func() { - f.CreateNamespace(namespace) + for _, ns := range append(additionalNamespaces, namespace) { + f.CreateNamespace(ns) + } }) ginkgo.AfterEach(func() { - f.DeleteNamespace(namespace, false) + for _, ns := range append(additionalNamespaces, namespace) { + f.DeleteNamespace(ns, false) + } }) body(namespace)